• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Turning Animation Help

D

Diddy Kong

Guest
Images of my code https://imgur.com/a/QEdKpfl

I need help with the sprites turning animation

I made it so if the player moved left or right a turning animation would play before they can move with their walking animation

Not pressing any keys would make the sprite have a idle animation

Holding the left and right key makes the player stop moving

The problem is that if I hold the left and right key the sprite animation keeps playing the turning animation

Trying to change the sprite to the idle animation if I hold the left and right key doesn't work either

Example would be while holding down the left key and releasing the right key would make the idle animation move left

I want to make it so if I hold down the both the keys the idle animation would play but if I released the opposite while holding the other the turn animation would play and then the player walks
 

Rob

Member
Here's some logic for you:

Code:
If left + right{
   display idle animation
}else{
  if left && !right{
     Display left turn animation
   }else{
      if right && !left{
          Display right turn animation
      }
   }
}
 
Top