stop the crouch animation from looping(noob question)

0 favourites
  • 6 posts
From the Asset Store
Ninja char for your game! Make your own Shinobi game with this art.
  • Hello guys:

    I'm setting the player inputs and the animation state to "crouch" but i don't know how can i make the animation to stop in the last frame and remain until I release the down button and it back to idle

    this is my actual code:

    + Keyboard: ? is down

    + OR Keyboard: S is down

    -> walking_mask: Set size to (106, 119)

    -> obj_player: Set animator to "crouch"

    I tried with this code:

    + Keyboard: ? is down

    + OR Keyboard: S is down

    -> walking_mask: Set Platform maximum speed to 0

    -> walking_mask: Set size to (106, 119)

    -> obj_player: Set animator to "crouch"

    ----+ obj_player: Animation frame = 16

    -----> obj_player: Stop animation

    and this code:

    + Keyboard: ? is down

    + OR Keyboard: S is down

    -> walking_mask: Set Platform maximum speed to 0

    -> walking_mask: Set size to (106, 119)

    ----+ System: Trigger once

    -----> obj_player: Set animator to "crouch"

    --------+ obj_player: Animation frame = 16

    ---------> obj_player: Stop animation

    but the crouch looping still looping

  • Have you unchecked the "repeat" box in the objects crouch animation?

  • Have you unchecked the "repeat" box in the objects crouch animation?

    Hello mOOnpunk I have recently found a solution:

    // crouch

    + Keyboard: S is down

    + walking_mask: Platform is on floor

    -> walking_mask: Set Platform maximum speed to 0

    -> walking_mask: Set size to (106, 119)

    -> obj_player: Set animator to "crouch"

    ----+ obj_player: Animation frame = 16

    -----> obj_player: Set animation speed to 0

    + Keyboard: On S released

    + walking_mask: Platform is on floor

    -> walking_mask: Set size to (213, 239)

    -> walking_mask: Set Platform maximum speed to 1800

    works fine!

  • I think you could save yourself a lot of code, if you just turned off the repeat checkbox in the animation properties of the animation editor of the crouching animation (phew, that's a lot of animation!)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think you could save yourself a lot of code, if you just turned off the repeat checkbox in the animation properties of the animation editor of the crouching animation (phew, that's a lot of animation!)

    Hello joelmayer thanks for your reply:

    ¿you mean if the loop box is unchecked? yeah it was that's the weird thing

  • maybe even adding a subevent for when down arrow is pressed, with an extra condition of trigger once while true, and having the event as, set animation to - crouch

    then on released have it revert to w.e. animation

    but theres no right or wrong way, if you managed to make it work, kudos.

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