Animation Problems, canceling movement

0 favourites
  • 4 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • Hi! I just got started with Constructor 2 and I've run into a little problem.

    I have a character that I move with A and D. When I press one of those buttons my character will start moving along with an animation (named 'Walking'). This works fine, however:

    What I want to do is that when you release the move buttons, the character will finish it's move animation and then stop rather than stopping mid-animation. My problem though is that the character continues to move forever even though I've (I think) told it to stop moving after finishing it's animation. It's much easier to show what I mean by posting the event sheet, please see attachment.

    EDIT: Sorry, I meant the character continues to ANIMATE forever, not move. My mistake!

    EDIT SOLUTION: It seems that I got it to work, but not by using 'onFinish'.

    Here's what I did:

    At the keyboard A&D != check, I added 'isAnimationPlaying'

    And then I replaced 'onAnimationFinished' with 'compareFrame' to check if it's the last frame. If it is, then I stop the animation.

    Maybe I should've tried that before posting here, didn't think about it then though. Now we know at least!

    Help is greatly appreciated.

  • I'm looking at it. can u post a capx?

    Your write up is a little confusing.

    Can't really see everything, like is the animation set loop?

    If I get it, you just switch the animation instead of trying to stop it. Make a duplicate animation that is not set to loop and is triggered instead.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sure, attached the file.

    I got it to work somewhat but I still have one problem. Now, when you release the button slightly before the animation ends, the character will glide on the floor for the duration of the movement. Can I somehow do a check to see if he's still moving when the animation has ended to squeeze in another loop to smooth things out?

  • So I digged a bit deeper into the manual and it seems that looped animations don't finish. That's why onAnimationFinish won't work. So, is there a way to toggle off loops for animations mid-game? Because I have an idea of how to get it to work if I can do that somehow.

    EDIT: So I found a way to make it work. I played around with the idea of additional animations like you mentioned and I found a solution:

    What I did was that I created 2 additional animations, one for when the player release the move keys when the character stands mid-walk on her right foot and one for when she stands mid-walk on her left. What I did then was I compared the current frame of the walk animation for when the key released (for example, if I release the move key on frame 4, which is the right foot) then I'd play one of the additional animations that start on corrisponding foot, and vice versa).

    So I finally got it work like I want it to. Problem solved.

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