When I call some animations they are playing only the first frame and then stop. Any ideas?

0 favourites
  • 6 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • How can I upload the .c3p file here? Thanks.

  • It looks like you're starting the animation over every tick.

    Your code says "Every tick, if down is pressed, start playing the crouch animation at frame 0."

    I think you only want to play the animation if it's not already playing. Try adding an "is not playing crouch" to your sub-event next to "is on floor".

  • Hi brushfe. Thanks for the reply. I've tried what you suggested, and she crouch, but doesn't return to idle. In fact, even without no sub, just the keyboard or gamepad command, she execute this behavior.

    I'm totally new to this, so it's probably the logic behind the events that I am getting wrong. Would you mind to try to explain the "order" and "conditions" in which I must pay attention to correctly build the code to execute several different animations?!

    Thanks from Brazil.

  • Sure thing! The important thing to remember about Event Sheets is that they're processed over and over, from top to bottom, in a never-ending loop (and dozens of loops per second).

    In your screenshot, for example, if the user is holding "down", the event in the red box is triggered every tick. Meaning around 60 times per second, the "crouch" animation is being played - from the beginning of the animation, which is why you're seeing it stuck on the first frame.

    In the screenshot below, you can see the "Duck" animation only starts playing if it's not playing already. So the user can hold the down key as long as they want, but the "Duck" animation will only play once, and play all the way through.

    Let me know if this answers your question!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm using state-driven system. There is a global variable player_State or player_Phase and list of constants like phase_Idle, phase_Run and so on.

    And for each phase there are checks:

    1. If buttons are not pressed and player_Phase is not death or hit or something else undependent from buttons then if animation is not Idle then play this animation and set phase to idle
    2. If joystick pressed and no buttons pressed and block_Input isn't set (in cases of cast, death, hit or tweens, slashes) and animation isn't run then set phase to run and play animation run
    3. If button pressed and phase is not death, hit or other already going slash/cast/combo and so on, so...

    In each case you can check what player phase is going now and allow or block other actions, interaction with enemies or surroundings

    I.e. if player phase is "shield_Blocking" while enemy phase is "Attacking" player will get no hurt. Otherwise if player is chilling in "Idle" enemy will hurt if in attacking phase

    To return into Idle phase just check if "Slash" or "Jump" animation ended and there are no buttons pressed.

    Something like that

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