Spawn hit fx

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  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
spawn_hit_fx(x, y, hit_fx_index);

Returns
real (instance ID)

Basic
// 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
// 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; }