Log In  

Is there any PICO-8 or Lua method or something which turns off (something similar) the game when player is lost?

P#51243 2018-04-03 07:27 ( Edited 2018-04-05 11:17)

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
P#51250 2018-04-03 09:18 ( Edited 2018-04-03 13:19)

if you are looking to exit the cart and return to the PICO-8 command line, you can use STOP()

P#51314 2018-04-04 17:07 ( Edited 2018-04-04 21:07)

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

P#51315 2018-04-04 17:15 ( Edited 2018-04-04 21:15)

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

P#51316 2018-04-04 17:23 ( Edited 2018-04-04 21:23)

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?

P#51333 2018-04-05 06:52 ( Edited 2018-04-05 10:52)

see my response - you can change game logic based on the is_playing.

P#51334 2018-04-05 07:17 ( Edited 2018-04-05 11:17)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-20 10:59:29 | 0.008s | Q:22