Movement and direction of avatar

  • I just started working with C2 and I love it. I searched the forum but couldn't find any solutions to my "problem". But I think the biggest problem is that I'm not used to C2 yet (and how to think/build things).

    What I want to do is that I have 8way 45-degree movement but if I hold down and then press left I want it to keep the animation set for down but If I release down and keep holding left it should switch to the left animations and so on. Much like the old Zelda 3.

    I want to later add attacks to this etc and the avatar should only swing/shoot in the direction he is "looking" so to say.

    So how do I set up this in a good way so I can continue build on it?

  • Wait... You want 8-directions of movement but only 4 directions of animation? Won't that look strange?

  • I tried to use some kind of multi button keypress animation but it didn't work for me.

    Still trying to figure out how to do it properly, all my results made the animation to lock when pressing 2 directions at the same time e.g. left + up.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The technique you should apply is seperating animation control and keyboard control. Please be aware, that not all keys work together in a multi-key solution, due to hardware restrictions.

    What you could do is, take a global variable, that represents the animation you want to play and have each keypress modify this variable.

  • I tried this case now with entering a global variable on a specific value which triggers an animation. But it did not work.. What I need is something that could override the basic animation pattern and button config.

    All my player animation are all in 1 event group with the name PlayerAnimation

    I added -> Add global variable

    Named it to: AnimationModify

    Initial Value: 0

    And I added 1 action to Keyboard -> Left arrow is down -> System -> Add 1 to AnimationModify

    Added 1 action to Keyboard -> Down arrow is down -> System -> Add 2 to AnimationModify

    Added 1 action to Keyboard -> Left arrow is released -> System -> Subtract 1 from AnimationModify

    Added 1 action to Keyboard -> Down arrow is released -> System -> Subtract 2 from AnimationModify

    Added -> System -> AnimationModify = 3 -> PlayerImages -> Set animation to "RunningDown" (play from beginning)

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