How do I fix my death code?

0 favourites
  • 3 posts
From the Asset Store
5 levels with simple coding Source-code (.c3p) + HTML5 Exported
  • I've coded it and have attempted to fix it, by disabling the player 8direction and re-enabling it, but the player doesn't play the death animation on the same layout. Still, my death animation keeps playing on the click to return to "level 0" I've been very close to pulling some strands of hair out.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Shouldn't the variable isDead be called isAlive instead? isAlive=1 means the player is alive. isAlive=0 means not alive any more. (since in any programming language 1 is true and 0 is false)

    Checking if the player has any health left or if it's dead on every tick is not a good practice. I suggest you move these event inside the event where the player actually receives damage. For example:

    Bullet On Collision with Player : Player subtract 1 from Health
    
    .... Player health<=0
    .... : Player set isAlive=0
    .... : Player play animation "Death"
    

    See if it helps. If the animation still doesn't work, run the game in debug mode and check the variables on the Player object.

  • Thank you for your input, overlooking your reply has sparked that I use a second save file to simply load back to "base camp" which always saves while in the area. thank you :)

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