I
</iKON1K>
Guest
Hello! I am currently working on animation for my character in my platformer game, and it does not work quite right. Here is the code I currently have
Problem is, once my player starts falling, and sprite changes to falling sprite, once the player hits the ground, falling sprite never goes away. I tried to check for ground, and then change the sprite, but it did not work as well. I would love to receive any suggestions on how I should fix that issue. Thank you.
Code:
// Control the sprite
image_speed = sign(len)*.4;
if(len == 0) image_index = 8;
// Vertical sprites
if(vspd > 0){
sprite_index = s_player_down;
}else if(vspd < 0){
sprite_index = s_player_up;
}else if(vspd == 0){
sprite_index = s_player_right;
}
// Horizontal sprite
if(hspd > 0){
sprite_index = s_player_right;
} else if(hspd < 0){
sprite_index = s_player_left;
}