ocean anim

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

View File

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