@Pvic - [E.B. Leader] I need help with creating afterimages.
create an object, name it obj_afterimage (or whatever you want to name it) go into the Step event, drag in a code action, paste this in the code:
image_alpha -= 0.1
if image_alpha <= 0 {instance_destroy()}
(also set its depth to 1) then go into your obj_character's step event and paste this code in somewhere:
if (abs(speed_x) > 5){
afterimage = instance_create(floor(x),floor(y),obj_afterimage)
afterimage.sprite_index = player_sprite;
afterimage.image_index = floor(animation_frame);
afterimage.image_speed = 0;
if (action != ConActRoll) afterimage.image_angle = angle;
afterimage.image_alpha = 1;
afterimage.image_xscale = animation_direction;
}
(edited)
@Umbreon From Da Hood
this will give your character afterimages if they're going over the speed of 5
@Trevguy Thanks! Also, When Sonic moves the opposite direction, the afterimages appear the opposite direction. Any way to fix it? ^^
yes; updated it (the new line of code is at the end before the close bracket) @Umbreon From Da Hood
Thanks. Again. XD
1
March 28, 2018
Now, how would I give the afterimages a certain color? (e.g. Sonic = blue, Tails = orange, Knuckles = red, etc.)
@Trevguy
at the end of that code, before the end bracket, put afterimage.image_blend = c_blue;
or afterimage.image_blend = c_red;
you can see what's available by only typing c_
and waiting; after a while it'll show you what colors you can do alternatively you can tell it rgb values afterimage.image_blend = make_color_rgb(255,50,20);
and to make it character specific you put before it (on the same line as the code), if (character == ConCharSonic)
or if (character == ConCharTails)
so it would be: if (character == ConCharSonic) afterimage.image_blend = c_blue;
So, this would still be positioned at the end of the code before the bracket right?
yes
if you put any of this afterimage.
stuff after the bracket you'll get an error
Sweet! Thanks for the heads up.
1
Oh, I almost forgot to ask about something else. The afterimages show the color but the original sprite ends up that color too. I s there any way to fix that?
let me investigate this in my gmk
Alright then!^^
it's not happening for me what's your code say at this point?
if (abs(speed_x) > 9) { afterimage = instance_create(floor(x),floor(y),obj_afterimage) afterimage.sprite_index = player_sprite; afterimage.image_index = floor(animation_frame); afterimage.image_speed = 0; if (action != ConActRoll) afterimage.image_angle = angle; afterimage.image_alpha = 1; afterimage.image_xscale = animation_direction; if (character == ConCharSonic) afterimage.image_blend = c_blue; if (character == ConCharTails) afterimage.image_blend = c_orange; if (character == ConCharKnuckles) afterimage.image_blend = c_red; }
oh go to obj_afterimage and set the depth to 1, instead of -1
that should fix it
For a heads up, this is how the conversation looks like in discord.
https://cdn.discordapp.com/attachments/403203277568606219/429277713371758593/unknown.png
https://cdn.discordapp.com/attachments/403203277568606219/429277801216999434/unknown.png
https://cdn.discordapp.com/attachments/403203277568606219/429277864098267147/unknown.png
https://cdn.discordapp.com/attachments/403203277568606219/429277924122689546/unknown.png