moonbus: docking hints
This commit is contained in:
parent
762a895665
commit
7b0fd5c3ef
32
moonbus.p8
32
moonbus.p8
@ -13,6 +13,10 @@ function reset()
|
|||||||
plr_static=false
|
plr_static=false
|
||||||
plr_engine=-1
|
plr_engine=-1
|
||||||
plr_fuel=1
|
plr_fuel=1
|
||||||
|
plr_landings=0
|
||||||
|
plr_transed=0
|
||||||
|
plr_money=0
|
||||||
|
plr_target={x=8,y=2}
|
||||||
|
|
||||||
telem_spd={}
|
telem_spd={}
|
||||||
|
|
||||||
@ -21,6 +25,7 @@ function reset()
|
|||||||
fuel_cons=0.01
|
fuel_cons=0.01
|
||||||
land_speed_limit=1
|
land_speed_limit=1
|
||||||
maph=8
|
maph=8
|
||||||
|
bonus_docked=1
|
||||||
cam={}
|
cam={}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -95,6 +100,7 @@ function _update()
|
|||||||
plr_pos={x=flr(plr_pos.x+0.5),y=flr(plr_pos.y+0.5)}
|
plr_pos={x=flr(plr_pos.x+0.5),y=flr(plr_pos.y+0.5)}
|
||||||
plr_docked=true
|
plr_docked=true
|
||||||
plr_static=true
|
plr_static=true
|
||||||
|
plr_landings+=1
|
||||||
sfx(1)
|
sfx(1)
|
||||||
break
|
break
|
||||||
elseif solid or plr_pos.y<=0 then
|
elseif solid or plr_pos.y<=0 then
|
||||||
@ -149,7 +155,25 @@ function _draw()
|
|||||||
pset(px,py,8)
|
pset(px,py,8)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- target
|
||||||
|
if plr_alive then
|
||||||
|
local tx,ty=to_scrn(plr_target)
|
||||||
|
local dst=dist(plr_pos,plr_target)
|
||||||
|
local c=flr(t())%2==0 and 3 or 11
|
||||||
|
if dst > 8 then
|
||||||
|
local dir=atan2(tx-px,ty-py)
|
||||||
|
line(px+4+cos(dir)*10,py+4+sin(dir)*10,tx+4,ty+4,c)
|
||||||
|
end
|
||||||
|
if dst > 3 then
|
||||||
|
print("웃",tx,ty+2,c)
|
||||||
|
else
|
||||||
|
print("__",tx,ty+4,c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
-- HUD
|
-- HUD
|
||||||
|
--
|
||||||
camera(0,0)
|
camera(0,0)
|
||||||
|
|
||||||
-- fuel
|
-- fuel
|
||||||
@ -187,6 +211,9 @@ function _draw()
|
|||||||
print("oops! you crashed.", 0,0,8)
|
print("oops! you crashed.", 0,0,8)
|
||||||
print("press ❎ to reset.", 32,60,11)
|
print("press ❎ to reset.", 32,60,11)
|
||||||
end
|
end
|
||||||
|
print("⌂"..plr_landings, fx,fy+fh+2+0,3)
|
||||||
|
print("웃"..plr_transed, fx,fy+fh+2+8,3)
|
||||||
|
print("✽"..plr_money, fx,fy+fh+2+16,3)
|
||||||
end
|
end
|
||||||
|
|
||||||
function to_scrn(p)
|
function to_scrn(p)
|
||||||
@ -229,8 +256,9 @@ function neg(p)
|
|||||||
return mul(p,-1)
|
return mul(p,-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function dist(p)
|
function dist(p,p2)
|
||||||
return abs(p.x) + abs(p.y)
|
p2=p2 or {x=0,y=0}
|
||||||
|
return abs(p.x-p2.x) + abs(p.y-p2.y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function unit(p,u)
|
function unit(p,u)
|
||||||
|
Loading…
Reference in New Issue
Block a user