C
ChrisMG12
Guest
I have made my sprites for moving left and right and idle position work without any glitches. however whenever i jump the same sprites for being idle and moving left and right occur, is there any code that can help me with this. the code is from this video,
.
i also added this code for the sprites for the sprite change in idle (l and r) and moving (l and r)(with help from CloseRange)
dir = sign(x - xprevious);
if dir != 0 last_dir = dir;
if (dir == 1)
{
sprite_index = spr_character_running_right; // RIGHT MOVING SPRITE
}
if (dir == -1)
{
sprite_index = spr_character_running_left; // LEFT MOVING SPRITE
}
if (dir == 0) {
if (last_dir == 1)
{
sprite_index = spr_character_facingright; // RIGHT IDLE SPRITE
}
if (last_dir == -1) {
sprite_index = spr_character_facingleft; // LEFTIDLE SPRITE
}
}
i also added this code for the sprites for the sprite change in idle (l and r) and moving (l and r)(with help from CloseRange)
dir = sign(x - xprevious);
if dir != 0 last_dir = dir;
if (dir == 1)
{
sprite_index = spr_character_running_right; // RIGHT MOVING SPRITE
}
if (dir == -1)
{
sprite_index = spr_character_running_left; // LEFT MOVING SPRITE
}
if (dir == 0) {
if (last_dir == 1)
{
sprite_index = spr_character_facingright; // RIGHT IDLE SPRITE
}
if (last_dir == -1) {
sprite_index = spr_character_facingleft; // LEFTIDLE SPRITE
}
}