Creates a visual effect to be used with your custom character. Returns the index of visual effect, to be stored for later use. This function permanently stores the data of the visual effect, so be sure to only call it once per effect, not anywhere that runs every frame (like update.gml).
Use either
asset_get( sprite ) Reference→sprite_get( sprite ) Reference→
to retrieve the sprite ID.
Argument | Type | Description |
---|---|---|
sprite_index | :real | The ID of the sprite to be used as a visual effect |
animation_length | :real | The length of the effect animation, in frames |
Example, called from init.gml:
// creates a 30 frame explosion effect:
cool_effect = hit_fx_create( sprite_get( "cool_explosion" ), 30 );
Then in dspecial.gml:
// assigns the explosion effect to dspecial:
set_hitbox_value( AT_DSPECIAL, 1, HG_VISUAL_EFFECT, cool_effect );
You can also manually spawn the effect from, say, update.gml:
// spawns the custom effect at the specified position:
spawn_hit_fx( x, y, cool_effect );