C
Crimson Flames
Guest
I set something up for enemy animations, but it isn't working quite right. The up and down animations work fine (usually), but the left and right animations don't work at all. This code is run in the step event for the enemy, after the movement code. I've tried using this code in the draw event, but I have the same problem.
Code:
//Animation
Right = (sign(obj_Player.x - x) = 1);
Left = (sign(obj_Player.x - x) = -1);
Up = (sign(obj_Player.y - y) = -1);
Down = (sign(obj_Player.y - y) = 1);
if(Right){
sprite_index = spr_GlitchRight;
image_speed = AnimationSpeed;
}
if(Left){
sprite_index = spr_GlitchLeft;
image_speed = AnimationSpeed;
}
if(Down){
sprite_index = spr_GlitchDown;
image_speed =AnimationSpeed;
}
if(Up){
sprite_index = spr_GlitchUp;
image_speed = AnimationSpeed;
}
if (!Down and !Right and !Left and !Up){
image_index = 0;
image_speed=0;
}
Last edited by a moderator: