moonbus: reset after crash
This commit is contained in:
parent
d6df107843
commit
762a895665
42
moonbus.p8
42
moonbus.p8
@ -4,26 +4,35 @@ __lua__
|
|||||||
-- MoonBus
|
-- MoonBus
|
||||||
-- by Dejvino
|
-- by Dejvino
|
||||||
|
|
||||||
plr_alive=true
|
function reset()
|
||||||
plr_win=false
|
plr_alive=true
|
||||||
plr_docked=false
|
plr_win=false
|
||||||
plr_pos={x=5,y=8}
|
plr_docked=false
|
||||||
plr_speed={x=0.5,y=0}
|
plr_pos={x=5,y=8}
|
||||||
plr_static=false
|
plr_speed={x=0.5,y=0}
|
||||||
plr_engine=-1
|
plr_static=false
|
||||||
plr_fuel=1
|
plr_engine=-1
|
||||||
|
plr_fuel=1
|
||||||
|
|
||||||
telem_spd={}
|
telem_spd={}
|
||||||
|
|
||||||
gravity=0.02
|
gravity=0.02
|
||||||
engine_power=0.1
|
engine_power=0.1
|
||||||
fuel_cons=0.01
|
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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user