ocean anim

This commit is contained in:
James Turk 2023-04-16 20:33:33 -05:00
parent 516fc52517
commit 34712e3d54

View File

@ -53,16 +53,23 @@ function start_ocean()
end end
function draw_ocean() function draw_ocean()
cls(1) cls(0)
local ocean_anim = {0, 0, 0, 0, 0, 1, 2, 3, 4} local ocean_anim = {[0]=0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0}
-- if ocean_wind_x < 0 then if ocean_wind_x == 0 and ocean_wind_y == 0 then
-- end return
for x=0,16 do end
for y=0,16 do for x=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 base = 0
if ocean_wind_y != 0 then base = 5 end
if anim > 0 then
spr(base+anim, 8*x, 8*y, 1, 1, ocean_wind_x < 0, ocean_wind_y < 0)
end end
end end
end end
print("wind: "..ocean_wind_x..", "..ocean_wind_y)
end
function update_ocean() function update_ocean()
if btn(0) then if btn(0) then
@ -81,7 +88,7 @@ function update_ocean()
end end
end end
_scenes.ocean = {start=nil, draw=draw_ocean, update=update_ocean} _scenes.ocean = {start=start_ocean, draw=draw_ocean, update=update_ocean}
__gfx__ __gfx__