Is there any PICO-8 or Lua method or something which turns off (something similar) the game when player is lost?
nope - this must be handled by your game state.
Ex:
is_playing=true function _update() — game logic here ... if is_playing then if plyr_hp==0 then is_playing=false end else — wait for player to start if btnp(4) then is_playing=true — reset game state plyr_hp=10 ... end end end function _draw() cls() if is_playing then — draw world map(...) else print(‘game over - press start’,48,64,7) end end |
if you are looking to exit the cart and return to the PICO-8 command line, you can use STOP()
You really shouldn't exit your game when the player is lost, that's a bad practice... commonly you show a Game Over screen/text and go back to the title screen.
Also note about kittenm4ster suggestion of using STOP():
BBS or web doesn't support typing stuff in command line so you see the cursor but you can't interact with anything (only solution is to force a reset or refresh the page).
right, I agree it's usually not what you want :)
I was just trying to answer what I thought the question might be asking :p
Thank you everybody. All of your answers I seem useful. I have one more question.
In my game, button X is a button for shooting.
But when game is stopped, I want to use it as exit button if player wants to exit. Is it possible?
see my response - you can change game logic based on the is_playing.
[Please log in to post a comment]