RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Multiple lives and player dying on touch

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 81
Hi everyone,
I am trying to build a simple PRG with some arcade elements, and would like find a way to give the player a number of lives, which he/she would lose for certain things, such as touching some NPCs, or certain tiles (e.g. lava).

Every time a player dies, I would like him to reappear at the level entrance. I guess this can be done by using the transfer event but I am not sure how to let the character die more than once.

Thanks in advance!

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
What you'll need to do is run some checks, and having branching statements based on them. Do the following with events, using conditional branches as necessary.



At the start of the game, set a variable named Lives (or something similar) to (whatever number of lives you choose.)

When the player enters the room, have an event that runs automatically store the player's x and y locations to two variables. (You should call them hero_x and hero_y)

When the player reaches an event that causes them to lose a life, you must tell the event to:

First, check the total number of lives.
Second, if it is greater than one...
1. - Decrease the total number of lives by one.
2. - Fade out the screen, and move the player to hero_x and hero_y.
3. - Fade the screen back in.
If your total number of lives is EQUAL to one...
1. - Go to game over.



If you need anything clarified, or you need help, I'm in IRC Chat. IRC is not normally used for help or troubleshooting but, eh, I make exceptions. :)

**
Rep: +0/-0Level 81
Thanks a lot, that makes perfect sense!!!

********
Rep:
Level 96
2011 Most Missed Member2010 Zero To Hero
No problem amigo. :) If you want it to be a little less harsh on the player, you might have the game over check's number set to zero instead of one, making it work more similarly to games like megaman or mario.