How do I add a turning animation?

0 favourites
  • 10 posts
From the Asset Store
Customize the animation of character when item changed
  • Hello, I was wondering if somebody could help me code a turning animation. I can't find a simple step by step tutorial on how to do it. I have turning, walking, and idle animation and the codes: on right arrow pressed set not mirrored and on left arrow pressed set mirrored. I am guessing that I will need a string variable that tells left from right.

  • Wouldn't a turning animation slow the game down? A player wouldn't want to wait for the character to turn before moving, that's frustrating and it should be instant.

  • Hellolionz! Well the turning animation would be very quick, Like Wario from Wario land 3, or like Clara Mae from Night in the woods. I just would like my sprite to seem more real rather then always just going from left to right without any sort of "middle" animation to make the transition smoother.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think Wario is instant like Mario but the other game I checked out and see what you mean. My approach would be something like have variables for facing direction or you can use 'mirrored' condition, then if you are for example facing left, you say on right key pressed play right turning animation. Then for normal walking of the right key down you add a condition 'right turn animation not playing', so it only plays normal walk if you are not in the turning animation.

  • Hello lionz Thank you for the reply! So the codes I have now are as follows:

    On left arrow pressed, set animation to "Turningleft" then set mirrored. Then in another event: On right arrow pressed, set animation "TurningRight" Then set not mirrored. In another event, On TurningLeft animation finished, set animation "idle". The same codes then for the "TurningRight" animation. Then I have: Platform on moved, if animation Left and animation right are NOT playing, Set animation "Running".

    It's still not working and is only triggering when I am pressing an the left or right arrow when the "start ignoring platform user input" code is running. (I have a fade on the start of my layout that deactivates the player input while it's running) And even then it's still all wonky. This is so confusing because it seems weird to have two "left" and "right" animations when the system is set to mirror on the keys pressed.

  • Well your condition sounds like if both turn animations are playing at the same time which is not possible so that needs to be an OR. If the turn works mirrored then you can just set one turn animation and work with mirrored, that's why I mentioned it above. Remember also to add the condition when pressing left/right to start the turn about which way you are facing or you can keep pressing the same direction and it will spam turn.

  • So I rewrote the codes and the turning right animation works fine, but the turning left animation won't even trigger. The sprite just freezes up when you're facing left. But if you press right while facing left, the turning right animation plays fine. I'm new to construct so I'm probably missing a ton of stuff, so if anyone has a c3p file of how to do this, it would save a lot of time and frustration. My new codes are as such:

    On left arrow pressed and sprite is NOT mirrored, and Turning right is NOT playing, then set animation Turning left then set mirrored. The same codes for turning right with the mirror changed and the animation set to turning right. In another event, Is turning left animation is playing OR turning right is playing, then start ignoring player input. Then in another event, on turning right or turning left finished, stop ignoring player input and set animation idle. The set moving animation will only trigger if animation turning is not playing as well.

  • There I made something dropbox.com/s/kswepaunmu9ygtd/platformturn.c3p

  • Hello lionz, I will try the codes and post a reply when I finish them. Thank you for all of your help! :D

  • Update! The codes work wonderful!!! Thank you for your help!! :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)