0 Favourites

how do I add lives to my game?

  • 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

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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)
Similar Topics Posts Views Last Post
Unread sticky
763 305,737
asikanddestroy's avatar
asikanddestroy
Unread hot topic
282 387,943
Raybrite's avatar
Raybrite
Unread hot topic
232 177,703
Tetriser's avatar
Tetriser