[SOLVED] How do I Change between idle and moving animation?

0 favourites
  • 7 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hey guys, I'm new to game development and so far I'm liking it as a fun hobby but I've run into a confusing situation already. I have a sprite with animations for both idle and when moving and I am trying to use construct2 to make this little game. The issue is that I cannot figure out how to get the idle motion to play when the "D" or "A" keys are being pressed.

    I can get the "movinganimation" to constantly loop and move back and forth when "A" or "D" is pressed but when I am not pressing either the walking animation continues to loop.

    Here's my events so far:

    imgur.com/a/xgvy4

  • Keep the animations inside the same sprite so you can handle it easily.

    On <Set animation> you have to put the name of the animation you want to play. Use <Platform moving> for your issue:

    On platform moving>Sprite>Set animation to "moving"

    reverse that to stop

    On platform moving X>Sprite>Set animation to "idle"

  • imgur.com/a/PJT1b

    So I figured how to set the animations into one sprite and here is what I have so far for everything. does this look about correct?

  • I haven't been using C2 for that long, so not sure on best method for this. But my suggestion would be, you have an event there for the key press already, so use the action 'set animation' in there. Have it mirrored in the opposite direction for the other key press event.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is a little problem. When you use non default keys for platform you have to simulate the behaviour when pressed. Also, 1 pixel is way too little length, even for gameboy resolutions. One more thing: If this is a platform and your sprite is facing, let's say right, you have to mirror it when you press the opossite direction key.

    Check my example:

    Now, if you are using the top down RPG perspective (Zelda style), use the 8 direction behaviour instead, where you will have to use different animation for all directions (non mandatory).

  • Awesome! That helps so much more visually being able to see what I'm doing wrong! I'm super new to this so visuals help me a bit.

  • I'm glad I could help you 😊

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