ocean nav
This commit is contained in:
parent
b52ddbcdbc
commit
51d19fe4bf
@ -48,43 +48,53 @@ end
|
|||||||
_scenes.title = {start=nil, draw=draw_title, update=update_title}
|
_scenes.title = {start=nil, draw=draw_title, update=update_title}
|
||||||
|
|
||||||
function start_ocean()
|
function start_ocean()
|
||||||
ocean_wind_x = 0
|
|
||||||
ocean_wind_y = 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function draw_ocean()
|
function draw_ocean()
|
||||||
cls(12)
|
cls(12)
|
||||||
local ocean_anim = {[0]=0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0}
|
local ocean_anim = {[0]=0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0}
|
||||||
if ocean_wind_x ~= 0 or ocean_wind_y ~= 0 then
|
local wind_x = headings[wind_heading].dx
|
||||||
|
local wind_y = headings[wind_heading].dy
|
||||||
|
if wind_x ~= 0 or wind_y ~= 0 then
|
||||||
for x=0,15 do
|
for x=0,15 do
|
||||||
for y=0,15 do
|
for y=0,15 do
|
||||||
local anim = ocean_anim[(flr(time()*4) - ocean_wind_y*y - ocean_wind_x*x) % #ocean_anim]
|
local anim = ocean_anim[(flr(time()*4) - wind_y*y - wind_x*x) % #ocean_anim]
|
||||||
local base = 0
|
local base = 0
|
||||||
if ocean_wind_y ~= 0 then base = 5 end
|
if wind_y ~= 0 then base = 5 end
|
||||||
if anim > 0 then
|
if anim > 0 then
|
||||||
spr(base+anim, 8*x, 8*y, 1, 1, ocean_wind_x < 0, ocean_wind_y < 0)
|
spr(base+anim, 8*x, 8*y, 1, 1, wind_x < 0, wind_y < 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
map(player_x-8, player_y-8, 0, 0, 16, 16)
|
map(player_x-8, player_y-8, 0, 0, 16, 16)
|
||||||
-- DEBUG
|
|
||||||
print("player: "..player_x..", "..player_y.." heading: "..headings[player_heading].name)
|
|
||||||
print("wind: "..ocean_wind_x..", "..ocean_wind_y)
|
|
||||||
draw_ship(player_ship, player_heading, 64, 64)
|
draw_ship(player_ship, player_heading, 64, 64)
|
||||||
|
|
||||||
-- hud
|
-- hud
|
||||||
rectfill(0, 110, 128, 128, 15)
|
rectfill(0, 110, 128, 128, 15)
|
||||||
--pal(4, 132) -- leather
|
--pal(4, 132) -- leather
|
||||||
rect(0, 110, 127, 127, 4)
|
rect(0, 110, 127, 127, 4)
|
||||||
for x=0,128,16 do
|
-- for x=0,128,16 do
|
||||||
line(x, 110, x, 127, 4)
|
-- line(x, 110, x, 127, 4)
|
||||||
end
|
-- end
|
||||||
|
palt(0, false)
|
||||||
palt(1, true)
|
palt(1, true)
|
||||||
|
local icon_y = 118
|
||||||
|
local text_y = 112
|
||||||
-- compass
|
-- compass
|
||||||
print(headings[player_heading].name, 6, 112, 4)
|
print(headings[player_heading].name, 6, text_y, 4)
|
||||||
spr(73, 5, 118)
|
spr(73, 5, icon_y)
|
||||||
|
-- bird
|
||||||
|
print(headings[wind_heading].name.." "..wind_speed.." knots", 20, text_y, 4)
|
||||||
|
spr(74, 19, icon_y)
|
||||||
|
-- sextant
|
||||||
|
print(player_x..","..player_y, 60, text_y, 4)
|
||||||
|
spr(76, 60, icon_y)
|
||||||
|
-- cannon
|
||||||
|
print("3/3", 90, text_y, 4)
|
||||||
|
spr(77, 90, icon_y)
|
||||||
|
|
||||||
palt()
|
palt()
|
||||||
--spr_r(9, 4, 120, 120, 1, 1, false, false, 4, 4, headings[player_heading].angle, 1)
|
--spr_r(9, 4, 120, 120, 1, 1, false, false, 4, 4, headings[player_heading].angle, 1)
|
||||||
--function spr_r(i, j, x, y, w, h, flip_x, flip_y, pivot_x, pivot_y, angle, transparent_color)
|
--function spr_r(i, j, x, y, w, h, flip_x, flip_y, pivot_x, pivot_y, angle, transparent_color)
|
||||||
@ -135,6 +145,8 @@ player_x = 20
|
|||||||
player_y = 20
|
player_y = 20
|
||||||
player_heading = 0
|
player_heading = 0
|
||||||
last_move_time = 0
|
last_move_time = 0
|
||||||
|
wind_heading = 0
|
||||||
|
wind_speed = 0
|
||||||
|
|
||||||
-- external utils
|
-- external utils
|
||||||
|
|
||||||
@ -221,14 +233,14 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
|||||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
|
||||||
00000000000440000000000400000005000000000000000000000000000000000000000011555511000000001111119111149111111110010000000000000000
|
00000000000440000000000400000005000000000000000000000000000000000000000011555511111111111111119111149111111110010000000000000000
|
||||||
00000000004444000000004400000055000000000000000000000000000000000000000015668651000000001111144911149111111100000000000000000000
|
00000000004444000000004400000055000000000000000000000000000000000000000015668651111177711111144911149111111100000000000000000000
|
||||||
00044000004444000000044400000556000000000000000000000000000000000000000056688665000000001111994111999911111990000000000000000000
|
00044000004444000000044400000556000000000000000000000000000000000000000056688665117770711111994111999911111990000000000000000000
|
||||||
004ff400044ff440000044ff00000566000000000000000000000000000000000000000056688665000000001114491119149191110009010000000000000000
|
004ff400044ff440000044ff00000566000000000000000000000000000000000000000056688665117777991114491119149191110009010000000000000000
|
||||||
004ff40004f44f4000004fff00005566000000000000000000000000000000000000000056677665000000001999411191149991199009110000000000000000
|
004ff40004f44f4000004fff00005566000000000000000000000000000000000000000056677665777777711999411191149991199009110000000000000000
|
||||||
004ff40004f44f400077777400005566000000000000000000000000000000000000000056677665000000009669111191149119004441110000000000000000
|
004ff40004f44f400077777400005566000000000000000000000000000000000000000056677665177777719669111191149119004441110000000000000000
|
||||||
0044440004f44f400004466700005566000000000000000000000000000000000000000015676651000000009669111119149191004941110000000000000000
|
0044440004f44f400004466700005566000000000000000000000000000000000000000015676651111171119669111119149191004941110000000000000000
|
||||||
000000007777777700044ff507777775000000000000000000000000000000000000000011555511000000001991111111999911104441110000000000000000
|
000000007777777700044ff507777775000000000000000000000000000000000000000011555511111151111991111111999911104441110000000000000000
|
||||||
00000000077777700777777400077777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000077777700777777400077777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000046556400077777700055566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000046556400077777700055566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000004f55f400004566500055565000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0000000004f55f400004566500055565000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user