How do I make my player top moving when attacking?

0 favourites
  • 12 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hey everyone,

    I wonder how I can stop my character from moving when he is in attack animation.

    Thanks in Advance!

  • just don't simulate the right and left if in plat-former or in 8-direction when attacking. update us if it works

  • Sounds like that would do the trick but I can't figure out where these options are found

  • can you send your capx?

  • i can't download it

  • Hmm try this one then,

    dropbox.com/s/slplsab4akylast/Project.capx

  • If you want the player to only attack when not moving, simply add an event similar to the one below.

    Keyboard > on [attack key] pressed >>> Player > set animation to [attack animation]

    then, add a condition (right click on event and select add... and click condition).

    Player > compare speed > equal to 0

    and then add another event so you can get out of the attack animation.

    I'm not positive if this part works unless you replace: on [attack key] pressed with [attack key] is down. try that.

    Keyboard > on [attack key] released >>> Player > set animation to [default animation]

    I hope this helps!

    EDIT: alternatively, if you want your player to stop when attacking and you're using plat former, use these commands:

    Keyboard > [attack button] is down >>> Player > set Maximum speed to 0 > set acceleration to 0 > set deceleration to 0 > set animation to [attack animation]

    Keyboard > [attack button] released >>> Player > set Maximum speed to [original max speed] > set acceleration to [original acceleration] > set deceleration to [original deceleration] > set animation to [default animation]

    That might be more of what you're looking for.

  • If you want the player to only attack when not moving, simply add an event similar to the one below.

    Keyboard > on [attack key] pressed >>> Player > set animation to [attack animation]

    then, add a condition (right click on event and select add... and click condition).

    Player > compare speed > equal to 0

    and then add another event so you can get out of the attack animation.

    I'm not positive if this part works unless you replace: on [attack key] pressed with [attack key] is down. try that.

    Keyboard > on [attack key] released >>> Player > set animation to [default animation]

    I hope this helps!

    What if I want the attack animation to cause the player to stop moving? Example: you press Z and that causes the player to stop moving and start his attack animation.

  • Look above, I just posted an additional option which might help with that.

  • Look above, I just posted an additional option which might help with that.

    That one worked! Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem!

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