Animations Freezing upon starting a new one

0 favourites
From the Asset Store
Create your game with this complete pack of images and animations!
  • Here is an issue I've been having for a while in my game. Whenever my character gets hurt, it goes into the hurt animation, and what's supposed to happen is if you're not moving, the animation is supposed to change to the idle animation, and if you are, the animation is supposed to change to the walking animation. However, the hurt animation freezes on the last frame until you stop moving, and the idle animation is frozen as well and doesn't change to the walking animation when you start to walk.

    I would like to know what's wrong and how to fix it, if anyone knows. (Ignore the gun variable in my events, that's for determining which weapon you are holding, as the Player has separate animation sets for each weapon)

  • Those events look a bit messy. You need to keep them tighter for animations or you'll have problems, keep the trigger events in the top level. Based on what you described you would need these events :

    - On take damage, play hurt animation

    - Player not moving and not hurt/hurt animation not playing, play idle animation

    - Player is moving and not hurt/hurt animation not playing, play move animation

  • I do have it so the hurt animation plays when you get hit by something and take damage, such as in this instance, and i tried adding the "hurt is playing" inverted as another condition for my movement animation and that didn't help at all, or I didn't understand what you meant

  • If you take out the other logic you added and add mine in you should see it working. Player is not moving and animation hurt is not playing, play idle. Player is moving and animation hurt is not playing, play moving. The idea is that two animations shouldn't be trying to play at once which is why the freezing occurs. You have to make sure that no two events are true at once and the best way to avoid this is to keep the animation events very simple, also sometimes people use enable/disable groups to achieve this.

  • like this? I'm assuming I would need to add "on animation hurt finished" somewhere

  • The last 2 blocks yes but as separate events on their own, not sub events. You wouldn't need on animation hurt finished because as soon as it finishes those other events become true again, probably the idle one if you're not moving.

  • here's what it looks like now, yet it's still freezing. The only remnants of my original code is to do with how falling, landing, and jumping trigger animations

  • As mentioned you dont need 'on animation hurt finished'. Take that out, does it work as expected? You also need additional conditions 'is not jumping' and 'is not falling', anything that could cancel an animation from playing. On landed you shouldn't need as it will start up the idle or moving animation automatically.

  • not really. It freezes at the end of the hurt animation still, even when I took out the "on animation hurt finished" condition. It changes to the hurt animation just fine, but changing to the proper animation afterwards doesn't even happen unless I jump, which gets you stuck at the idle animation

  • You need to go back to basics and debug it for this, better to keep animations as simple as possible. Delete or disable everything, then begin with the 3 events I mentioned.

    Player is hurt : play hurt animation

    Player is not moving and hurt is not playing : play idle

    Player is moving and hurt is not playing : play walk

    See if that works first of all. If not then it's a problem with the hurt code that I haven't seen.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • regarding my "hurt" code, it's really just slapping on "set animation to hurt" whenever you collide with an enemy

    and I noticed something odd in the debug. when hurt finishes playing, the "is playing" is set to false, yet the current animation is still the hurt animation

  • That will just be the last played animation where it played once and didn't change to a new one. But it would with the events I mentioned.

  • I think I did it right, it doesn't have "on animation hurt finished" attached to either of them

  • Alright so I guess it's stuck on hurt animation now when you get hurt, but apart from that moving and idle switch is fine? So you will need to add back in on hurt finished, set idle as one event. Since you added is not jumping to those events you should be able to add in the jump animation too.

  • yeah, switching from idle and walking is fine, they were fine beforehand, it was switching to the hurt animation and it freezing on itself or when switching to the walk or idle animation that's been a headache for me to solve

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