Rivals of Aether

Rivals of Aether

Qua Mario
Floral qua Floral  [developer] 16 Nov, 2021 @ 10:15am
Compat for Devs: Freezable Objects
Making an object freezable is a two-step process. First, you have to add this to your init:
neo_data_compat = { freezable_objects: undefined };
Next, in the init.gml of the object you want Mario to be able to freeze, you have to add this:
if(player_id.neo_data_compat.freezable_objects != undefined) array_push(player_id.neo_data_compat.freezable_objects, self);
That's all that's necessary to make this work. Mario will automatically calculate the size of the ice block to encase the object. You can do this for projectiles and articles (although most projectiles will automatically be freezable already). Mario will automatically go through the list and remove any IDs that point to objects that were deleted, so don't worry about doing that yourself. However, that's why it's important you make sure to initialize freezable_objects as undefined, and check if it's been replaced with an array. That's how you know that there's a Mario present who will clean up the list for you.

For Advanced Users
For greater control, you can add neo_freeze_data to your object. Its init code would then look like this:
if(player_id.neo_data_compat.freezable_objects != undefined) {} array_push(player_id.neo_data_compat.freezable_objects, self); neo_freeze_data = { name: "Frozen Object", iframes: 4, can_be_frozen: true, extra_width: 0, extra_height: 0, extra_x_offset: 0, extra_y_offset: 0 } };
  • name: Cosmetic detail. Affects the death message that appears if Mario freezes your object and then kills Muno's Steve with it. Please include this it'd be very funny
  • iframes: The Ice Block can't be shattered by attacks for this many frames after being frozen. For instance, Sylvanos's jab-special razors have extra iframes because otherwise they'd be instantly shattered by the other razors.
  • can_be_frozen: If this is set to false, the object won't be freezable. This serves as a convenient toggle so you can have an object that is sometimes freezable, but sometimes isn't, without having to worry about manually removing your object from the freezables list.
  • extra_width: Makes the ice block that encases the object wider. Negative values can be used to make it thinner.
  • extra_height: Makes the ice block that encases the object taller. Negative values can be used to make it flatter.
  • extra_x_offset: Makes the ice block that encases the object appear further to the left (the object itself encased in the ice will remain where it was visually prior to being frozen; this specifically offsets the ice). Note that this is affected by the object's spr_dir.
  • extra_y_offset: Makes the ice block that encases the object appear lower (the object itself encased in the ice will remain where it was visually prior to being frozen; this specifically offsets the ice).
All of these values are optional; any that are missing will use the defaults shown above. (However hitboxes will use the name "Frozen Projectile" instead of "Frozen Object")
Note: Mario will automatically attempt to freeze most projectiles. If he can already freeze your projectile, don't push it into the freezable_objects list, because then you're making Mario check it twice per frame. Projectiles will use their neo_freeze_data values regardless of whether they're in the list or not. As such, if Mario is freezing a projectile that he shouldn't be, you can put this in its init:
neo_freeze_data = { can_be_frozen: false };
A shortcut that has the same effect is:
neo_freeze_data = false;
Either of these will make it so the iceballs will go right through your projectile.