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