How do I play an animation uninterrupted?

0 favourites
  • 5 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • I have a game that uses AWSD and the arrow keys for movement (8 directonal behaviour).

    When Health <= 0 the end game layout loads, which is a full screen animation.

    All works fine, except if a player is pressing one of the keys as he 'dies' the animation skips before it's played through.

    Things i've tried; Disabling controller at end of game and start of end game layout.

    Creating a variable (Can_move) assigning controls to Can_move=1 then disabling controls for Can_move=0 and adding this variable change at the end of the game screen and the start of the animation start.

    Can't get it to ignore the controls when my game ends????

    Can anyone advise please?

    Thanks.

  • Disabling the controls will only disable the movement but it won't stop your animation events which are probably on key pressed - play animation. Add a condition to your play animation for WASD events, to play only if hp > 0.

  • Disabling the controls will only disable the movement but it won't stop your animation events which are probably on key pressed - play animation. Add a condition to your play animation for WASD events, to play only if hp > 0.

    Here's the code for my endgame layout. Basically this happens when player health <=0.

    Left alone this plays fine. Problem is, usually the player is pressing one of the movement keys at the end of the game, which then skips the Endgame layout and animation completely.

    It's interesting what you say about disabling controls only disables movement. I hadn't thought of that. In which case, how do I stop any keypress from skipping the ending animation?

    Can you elaborate please?

  • Oh right this is different to what I imagined. So it looks like a bug, you have 'any key pressed' go to start screen so any key press will skip everything and go to other layout. You need to get rid of that and have it go to the start screen when the animation has finished on the event above. Or if you do want it on a key press, youll have to disable that event with a condition and have it true after a certain amount of time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yup. You're right!

    I fixed it in the end by adding an 'IF pressanykey is visible' - then activate keyboard.

    Worked great in the end.

    Thanks for the advice.

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