How do I make attack aniamtions cancel running

0 favourites
  • 6 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • I'm just using a basic 'while left key is down/player is on ground - play animation runleft' thing going on, but it means that I have a 'on space bar pressed' and 'while left key is down' 'play animation attack left' but the running left animation is still taking priority and the attack animation will only play. How can I make it so that the attack animation will cancel the run animation and play the attack animation instead?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One option is to create "states" using variables.

    ie. create variable called states=0 and then change it for example:

    idle states: state=0

    running state: state=1

    jumping state: state=2

    attacking state: state=3

    You can then stop/start animations/events based on the conditioning of these variables.

    Example: Space bar pressed, change state to 3. If state=3 run animation stops.

  • Thanks, I ended up solving the problem just by changing 'while left key is down' to 'when left key is pressed' though on the run animation. So that it didn't keep overwriting the attack animation.

  • That works too.

  • Hello. I have a similar problem. When my character is running and I press "F" the attack animation simply freezes on the first frame until I let go of "F". I'm trying to do it with instance variables, but I fear I'm doing them wrong or there is a logic problem.

  • DarijuSlav You need to provide capx files or sreenshots of your issue. Not enough information to tell what's going on there.

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