How To Make Lives

JustTooSmexiJustTooSmexi Member Posts: 7
edited November -1 in Working with GS (Mac)
Hey, I'm new to GS and im making a basic platform game and I have it so when the character runs into a bad guy or falls into lava the game restarts, but how do i make it so that he has 3 lives and if the game restarts 3 times then the games over and you have to restart from leval one?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Hey There

    Make a game attribute called lives. Set it to 3 or however many lives you want to have

    Then have rules when the player collides with the objects you want to take a life away
    -change attribute game.lives to game.lives-1

    then have another rule when game.lives=0
    change scene to game over or whatever you want

    then say you wanted a power up that added a life, you would have a rule when player collides with power up
    -change attribute game.lives to game.lives+1 (or however many lives u want to add)

    cheers
  • RedlerTechRedlerTech Member Posts: 1,583
    Create a self integer attribute called health (3)

    Rule when overlapping or collides with bad guy change attribute health to health-1

    Game integer attribute called restarts (0)

    Rule: When self.health is 0 & restarts doesn't = 3, change attribute game.restarts to game.restarts+1, & restart scene

    Rule: when self.health is 0 & restarts = 3, change scene to Game Over

    Matt :D
    _______________________________
    Project Help From $15 - Matthewredler@gmail.com

    EDIT: John beat me -.- :P
Sign In or Register to comment.