moonbus: reset after crash

This commit is contained in:
Dejvino 2024-08-09 20:23:58 +02:00
parent d6df107843
commit 762a895665

View File

@ -4,6 +4,7 @@ __lua__
-- MoonBus -- MoonBus
-- by Dejvino -- by Dejvino
function reset()
plr_alive=true plr_alive=true
plr_win=false plr_win=false
plr_docked=false plr_docked=false
@ -21,9 +22,17 @@ fuel_cons=0.01
land_speed_limit=1 land_speed_limit=1
maph=8 maph=8
cam={} cam={}
end
function _init()
reset()
end
function _update() function _update()
debug_points={} debug_points={}
if not plr_alive and btn(❎) then
reset()
end
-- controlls -- controlls
plr_engine=-1 plr_engine=-1
@ -90,6 +99,7 @@ function _update()
break break
elseif solid or plr_pos.y<=0 then elseif solid or plr_pos.y<=0 then
plr_speed.y*=-0.75 plr_speed.y*=-0.75
plr_speed.x*=0.5
plr_alive=false plr_alive=false
if (dist(plr_speed) > 1) then if (dist(plr_speed) > 1) then
sfx(0) sfx(0)
@ -168,12 +178,14 @@ function _draw()
if plr_alive then if plr_alive then
if plr_docked then if plr_docked then
print("smooth! you docked.", 0,0,3)
print("press ❎ to undock.", 32,60,11) print("press ❎ to undock.", 32,60,11)
else else
print("land gently to dock.", 0,0,3) print("land gently to dock.", 0,0,3)
end end
else else
print("oops! you crashed.", 0,0,8) print("oops! you crashed.", 0,0,8)
print("press ❎ to reset.", 32,60,11)
end end
end end