how do I add lives to my game?

0 favourites
  • 3 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • how so I add lives to my game so that when a certain monster hits him he loses a banana(life)

    also how do I make it to where when he jumps on a monster it kills it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In my case I add a variable number set to 3 to the player sprite, then when he collide a monster I substract one to the variable.

    I display hearts (bananas in your case)looking the variable.

  • Regarding lives, I think the easiest way would be to assign a global variable ("lives" or "health") to your player object, and upon collision with an enemy, subtract 1 from that variable.

    Then once "lives" reaches zero you can kill your player in any manner of ways.

    An instance variable would also work, but would be more appropriate if you have multiple players, or would like to assign a certain amount of health to each enemy.

    Jumping on a monster would be much easier with "overlapping at offset", but I don't think it's been implemented in C2 yet. I'd try comparing X and Y co-ordinates of the player in relation to the enemy to test if the player is on top of the enemy while colliding.

    There's an example of another way to do it here.

    edit: Here's how I would do it. link

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