Different animation when pressing 2 keys (diagonal movement)

0 favourites
  • 3 posts
From the Asset Store
This music pack covers differents situations for visual novels, anime games and many more!
  • Hi guys,

    My first post here. I'm making a Zelda-like game in which the player can move in 8 directions using the keyboard (WASD). Movement wise everything works fine. But for some reason the diagonal animations get stuck on their first frame.

    From what I've read on other forum posts, it seems to be due to the event running on every tick (therefore going back to the first frame of the animation over and over). However, adding a 'trigger once' condition as per my screen grab makes it even worse (the right animation stops loading).

    I found a few similar posts here but sadly none of them with solutions. This is the closest I've seen but quite frankly I'm not sure how to implement this: construct.net/forum/construct-2/how-do-i-18/two-key-diagonal-walk-60002

    Any ideas? I've only been using C3 for a couple of weeks so a bit out of my depth :(

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would set up a local variable in the player sprite which would change the variable to which ever button was being held e.g. Set local Variable to "UR" if the keys Up arrow and Right arrow are down. Then I could set up all the animations to play when that certain local variable is present.

  • Hey ALGSmith, thanks for such quick reply. I put together a quick test this morning using your suggestions and it worked like a charm! I'll still need to incorporate other stuff like the idle and attacking/shooting states for each position which I imagine will have their own challenges, but this logic makes a great starting point.

    Also making the working test available for anyone learning C3 like myself:

    dropbox.com/s/pv9pv68d0hfzo8t/8-directional%20character%20animation.c3p

    Thanks again!

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