Object needing the dash effect:
Create:
// timer you pass into the dash effect function
dash_timer = 0;
// The amount of time in frames to know how long until creating another effect
time_for_effect = 10;
Step:
++dash_timer;
create_new_dash(time_for_effect);
create_new_dash function:
// This function will take the dash time, and when the dash timer is a multiple of the time for effect, create a dash effect
// White is the default color and displays the sprite normally
function create_new_dash(time, cols = c_white) {
if (dash_timer mod time == 0) {
// Can also use a with statement
var dash = instance_create_layer(x, y, "Instances", obj_dash_effect);
dash.sprite_index = sprite_index;
dash.image_index = image_index;
dash.image_angle = image_angle;
dash.image_blend = cols;
}
}
Dash effect object (obj_dash_effect):
Create:
image_alpha = .8;
fade_amount = .05;
Step:
// Fade out as long as the image alpha is above 0
if (image_alpha > 0) {
image_alpha -= inc;
} else {
instance_destroy();
}
Available at: itch.io, moddb.com, indiedb.com, and the official website!