moonbus: docking telemetry
This commit is contained in:
parent
160e3647e8
commit
2446f5d659
31
moonbus.p8
31
moonbus.p8
@ -11,6 +11,8 @@ plr_speed={x=0.5,y=0}
|
|||||||
plr_static=false
|
plr_static=false
|
||||||
plr_engine=-1
|
plr_engine=-1
|
||||||
|
|
||||||
|
telem_spd={}
|
||||||
|
|
||||||
gravity=0.02
|
gravity=0.02
|
||||||
engine_power=0.2
|
engine_power=0.2
|
||||||
land_speed_limit=1
|
land_speed_limit=1
|
||||||
@ -59,7 +61,6 @@ function _update()
|
|||||||
local pmaps=mget(p.x,maph-p.y)
|
local pmaps=mget(p.x,maph-p.y)
|
||||||
local target=fget(pmaps,7)
|
local target=fget(pmaps,7)
|
||||||
local solid=fget(pmaps,0)
|
local solid=fget(pmaps,0)
|
||||||
add(debug_points,p)
|
|
||||||
if plr_win != true and target and dist(plr_speed) < land_speed_limit and p.y < pc.y then
|
if plr_win != true and target and dist(plr_speed) < land_speed_limit and p.y < pc.y then
|
||||||
plr_win=true
|
plr_win=true
|
||||||
plr_speed={x=0,y=0}
|
plr_speed={x=0,y=0}
|
||||||
@ -81,6 +82,10 @@ function _update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if plr_alive then
|
||||||
|
telem_spd=mul(plr_speed,1)
|
||||||
|
end
|
||||||
|
|
||||||
cam={x=plr_pos.x*8-60, y=0}
|
cam={x=plr_pos.x*8-60, y=0}
|
||||||
camera(cam.x,cam.y)
|
camera(cam.x,cam.y)
|
||||||
end
|
end
|
||||||
@ -110,8 +115,20 @@ function _draw()
|
|||||||
pset(px,py,8)
|
pset(px,py,8)
|
||||||
end
|
end
|
||||||
|
|
||||||
local p=plr_pos
|
-- telemetry
|
||||||
print(p.x.." "..p.y, cam.x, cam.y)
|
local cr=10
|
||||||
|
local cp={x=cam.x+127-cr,y=cam.y+cr}
|
||||||
|
local spd={x=limit(telem_spd.x,1),y=limit(telem_spd.y,1)}
|
||||||
|
circ(cp.x,cp.y,cr,3)
|
||||||
|
line(cp.x,cp.y,cp.x+spd.x*cr,cp.y,11)
|
||||||
|
line(cp.x,cp.y,cp.x,cp.y-spd.y*cr,11)
|
||||||
|
circ(cp.x+spd.x*cr,cp.y-spd.y*cr,1,dist(telem_spd)<land_speed_limit and 3 or 8)
|
||||||
|
if not plr_alive then
|
||||||
|
line(cp.x+(-0.3*cr),cp.y+(-0.6*cr),cp.x,cp.y,5)
|
||||||
|
line(cp.x+(-0.7*cr),cp.y+(-0.3*cr),cp.x,cp.y,5)
|
||||||
|
line(cp.x,cp.y,cp.x+0.6*cr,cp.y+0.3*cr,5)
|
||||||
|
line(cp.x+0.6*cr,cp.y+0.3*cr,cp.x+0.2*cr,cp.y+0.8*cr,5)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function to_scrn(p)
|
function to_scrn(p)
|
||||||
@ -168,6 +185,12 @@ function unit(p,u)
|
|||||||
if p.y<0 then y=-u end
|
if p.y<0 then y=-u end
|
||||||
return {x=x,y=y}
|
return {x=x,y=y}
|
||||||
end
|
end
|
||||||
|
function limit(val,lim)
|
||||||
|
if (abs(val) > lim) then
|
||||||
|
return val*lim/abs(val)
|
||||||
|
end
|
||||||
|
return val
|
||||||
|
end
|
||||||
__gfx__
|
__gfx__
|
||||||
000000000000000000000000000000000000aa00000000000000b000000000000000000000000000000000000000000000000000000000000000000000000000
|
000000000000000000000000000000000000aa00000000000000b000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00a9a90000a9a90000a9a90000a9a90000a9000000a9a9000000b000000000000000000000000000000000000000000000000000000000000000000000000000
|
00a9a90000a9a90000a9a90000a9a90000a9000000a9a9000000b000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -215,7 +238,7 @@ __map__
|
|||||||
1010101010101010141010101010101010101010101010101013110000111210101010101010101010101013110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
1010101010101010141010101010101010101010101010101013110000111210101010101010101010101013110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
1010101010101010101010101010101010101010101010101010101414101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
1010101010101010101010101010101010101010101010101010101414101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
__sfx__
|
__sfx__
|
||||||
000400003665038650396503965039650396503765035650316502f6502c6502965027650226501d65019650166501465012650116500e6500c6500a650076500465001650006500000000000000000000000000
|
000400002c2501f250132503365036650396503765035650316502f6502c650246501d6501b6501b65019650126500e65010650116500c6500d6500e6500c6500a65007650016500065000000000000000000000
|
||||||
010800000a4500a4500a4503d0502d0503d0502645026050264503363021630196401065003650006400063000620006100461000000000000000000000000000000000000000000000000000000000000000000
|
010800000a4500a4500a4503d0502d0503d0502645026050264503363021630196401065003650006400063000620006100461000000000000000000000000000000000000000000000000000000000000000000
|
||||||
0010002030650336502f6502a6502a6502b6502c6502e650306503165033650346502f6502b6502c6502d6502e6502a65029650296502b6502d650306502f6502d6502d6502e6502f650306502c6502e6502f650
|
0010002030650336502f6502a6502a6502b6502c6502e650306503165033650346502f6502b6502c6502d6502e6502a65029650296502b6502d650306502f6502d6502d6502e6502f650306502c6502e6502f650
|
||||||
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user