spawn_hit_fx() (sample page)

From Rivals of Aether Unofficial Workshop Manual


With this function you can spawn a visual effect at any given point within the room. The visual effect is spawned as a new instance of the hit_fx_obj object. This function returns the ID of the new instance which can then be stored in a variable or used to access that instance.

Syntax[edit | edit source]

spawn_hit_fx(x, y, hit_fx_index);

Arguments[edit | edit source]

Argument Type Description
x real The x position the hit_fx_obj instance will be created at
y real The y position the hit_fx_obj instance will be created at
hit_fx_index real The index of a built-in visual effect or a custom effect previously created with hit_fx_create( sprite_index, animation_length )

Returns[edit | edit source]

real (instance ID)

Examples[edit | edit source]

Basic[edit | edit source]

// attack_update.gml
// spawns built-in visual effect 195 (water large) on the 1st frame, 4th window of AT_FSPECIAL:
if (attack == AT_FSPECIAL && window == 4 && window_timer == 1) {
    spawn_hit_fx(x, y, 195);
}

Advanced[edit | edit source]

// init.gml
// creates a 20-frame visual effect from sprite "custom_fx_strip#.png" and stores its index in a variable:
custom_hit_fx = hit_fx_create(sprite_get("custom_fx"), 20);
// attack_update.gml
// spawns a visual effect, stores its instance ID in a local variable, and moves it to a depth in front of the player:
if (attack == AT_FSPECIAL && window == 4 && window_timer == 1) {
    var temp_fx = spawn_hit_fx(x, y, custom_hit_fx);
    temp_fx.depth = depth - 1;
}

See Also[edit | edit source]

Cookies help us deliver our services. By using our services, you agree to our use of cookies.