diff --git a/games/ocean.p8 b/games/ocean.p8 index ee75cb4..75882e4 100644 --- a/games/ocean.p8 +++ b/games/ocean.p8 @@ -52,23 +52,24 @@ function start_ocean() ocean_wind_y = 0 end + function draw_ocean() - cls(0) + cls(12) 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) + if ocean_wind_x != 0 or ocean_wind_y != 0 then + 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 print("wind: "..ocean_wind_x..", "..ocean_wind_y) + draw_ship(player_ship, 64, 64) end function update_ocean() @@ -90,24 +91,39 @@ end _scenes.ocean = {start=start_ocean, draw=draw_ocean, update=update_ocean} +function draw_ship(ship, x, y) + spr(ship.n, x-ship.w*4, y-ship.h*4, 1, ship.h) + if ship.w > 1 then + spr(ship.n, x-ship.w*4+8, y-ship.h*4, 1, ship.h, true) + end +end + +ship_type = { + small={n=64, w=1, h=1}, + medium={n=65, w=1, h=2}, + large={n=66, w=2, h=2}, + ghost={n=67, w=2, h=3} +} +player_ship = ship_type.ghost + __gfx__ -11111111111111111111111111111111111111111111111111111111111111111711111111111111111111111111111111111111000000000000000000000000 -11111111171111111117111111111711111111171111111111111111111117111111111111111111111111111111111111111111000000000000000000000000 -11111111111111111111111111111111111111111111111111111111171111111111711111111111111111111111111111111111000000000000000000000000 -11111111111111111111111111111111111111111111111111111711111111111111111111111111111111111111111111111111000000000000000000000000 -11111111117111111111171111111117111111111111111117111111111111111111111111111111111111111111111111111111000000000000000000000000 -11111111111111111111111111111111111111111111171111111111111171111111111111111111111111111111111111111111000000000000000000000000 -11111111171111111117111111111171111111111711111111171111111111111111111111111111111111111111111111111111000000000000000000000000 -11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000 -ffffffffffffffff111111111111ffffffff1111ffff111111111111111111111111ffff00000000000000000000000000000000000000000000000000000000 -ffffffffffffffff111111111111ffffffff1111fff11111111111111111111111111fff00000000000000000000000000000000000000000000000000000000 -ffffffffffffffff111111111111ffffffff1111ff1111111111111111111111111111ff00000000000000000000000000000000000000000000000000000000 -ffffffffffffffff111111111111ffffffff1111f111111111111111111111111111111f00000000000000000000000000000000000000000000000000000000 -ffffffff11111111ffffffff1111ffffffff1111111111111111111ff11111111111111100000000000000000000000000000000000000000000000000000000 -ffffffff11111111ffffffff1111ffffffff111111111111111111ffff1111111111111100000000000000000000000000000000000000000000000000000000 -ffffffff11111111ffffffff1111ffffffff11111111111111111ffffff111111111111100000000000000000000000000000000000000000000000000000000 -ffffffff11111111ffffffff1111ffffffff1111111111111111ffffffff11111111111100000000000000000000000000000000000000000000000000000000 +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc7cccccccccccccccccccccccccccccccccccccc000000000000000000000000 +ccccccccc7ccccccccc7ccccccccc7ccccccccc7ccccccccccccccccccccc7cccccccccccccccccccccccccccccccccccccccccc000000000000000000000000 +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc7cccccccccc7ccccccccccccccccccccccccccccccccccc000000000000000000000000 +ccccccccccccccccccccccccccccccccccccccccccccccccccccc7cccccccccccccccccccccccccccccccccccccccccccccccccc000000000000000000000000 +cccccccccc7cccccccccc7ccccccccc7ccccccccccccccccc7cccccccccccccccccccccccccccccccccccccccccccccccccccccc000000000000000000000000 +ccccccccccccccccccccccccccccccccccccccccccccc7cccccccccccccc7ccccccccccccccccccccccccccccccccccccccccccc000000000000000000000000 +ccccccccc7ccccccccc7cccccccccc7cccccccccc7ccccccccc7cccccccccccccccccccccccccccccccccccccccccccccccccccc000000000000000000000000 +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc000000000000000000000000 +ffffffffffffffffccccccccccccffffffffccccffffccccccccccccccccccccccccffff00000000000000000000000000000000000000000000000000000000 +ffffffffffffffffccccccccccccffffffffccccfffccccccccccccccccccccccccccfff00000000000000000000000000000000000000000000000000000000 +ffffffffffffffffccccccccccccffffffffccccffccccccccccccccccccccccccccccff00000000000000000000000000000000000000000000000000000000 +ffffffffffffffffccccccccccccffffffffccccfccccccccccccccccccccccccccccccf00000000000000000000000000000000000000000000000000000000 +ffffffffccccccccffffffffccccffffffffcccccccccccccccccccffccccccccccccccc00000000000000000000000000000000000000000000000000000000 +ffffffffccccccccffffffffccccffffffffccccccccccccccccccffffcccccccccccccc00000000000000000000000000000000000000000000000000000000 +ffffffffccccccccffffffffccccffffffffcccccccccccccccccffffffccccccccccccc00000000000000000000000000000000000000000000000000000000 +ffffffffccccccccffffffffccccffffffffccccccccccccccccffffffffcccccccccccc00000000000000000000000000000000000000000000000000000000 3333333333333333ffffffffffff33333333ffff3333ffffffffffffffffffffffff333333333333333333333333333333333333000000000000000000000000 3333333333333333ffffffffffff33333333ffff333ffffffffffffffffffffffffff33333333a33333333333333333333333333000000000000000000000000 3333333333333333ffffffffffff33333333ffff33ffffffffffffffffffffffffffff333333333333a3333333a3338333333383000000000000000000000000 @@ -124,14 +140,14 @@ ffffffff11111111ffffffff1111ffffffff1111111111111111ffffffff11111111111100000000 55555555ffffffff55555555ffff55555555ffffffffffffffffff5555ffffffffffffff55555555555555555595555555555555000000000000000000000000 55555555ffffffff55555555ffff55555555fffffffffffffffff555955fffffffffffff55955555555555955555955555555595000000000000000000000000 55555555ffffffff55555555ffff55555555ffffffffffffffff55555555ffffffffffff55555555555555555555555555555555000000000000000000000000 -00000000000440000000000400000005000000000000000000000000000000000000000000000000000000000000009000049000ccccc00c0000000000000000 -00000000004444000000004400000055000000000000000000000000000000000000000000000000000000000000044900049000cccc00000000000000000000 -00044000004444000000044400000556000000000000000000000000000000000000000000000000000000000000994000999900ccc990000000000000000000 -004ff400044ff440000044ff00000566000000000000000000000000000000000000000000000000000000000004490009049090cc00090c0000000000000000 -004ff40004f44f4000004fff00005566000000000000000000000000000000000000000000000000000000000999400090049990c99009cc0000000000000000 -004ff40004f44f40007777740000556600000000000000000000000000000000000000000000000000000000966900009004900900444ccc0000000000000000 -0044440004f44f40000446670000556600000000000000000000000000000000000000000000000000000000966900000904909000494ccc0000000000000000 -000000007777777700044ff507777775000000000000000000000000000000000000000000000000000000000990000000999900c0444ccc0000000000000000 +00000000000440000000000400000005000000000000000000000000000000000000000000000000000000001111119111149111111110010000000000000000 +00000000004444000000004400000055000000000000000000000000000000000000000000000000000000001111144911149111111100000000000000000000 +00044000004444000000044400000556000000000000000000000000000000000000000000000000000000001111994111999911111990000000000000000000 +004ff400044ff440000044ff00000566000000000000000000000000000000000000000000000000000000001114491119149191110009010000000000000000 +004ff40004f44f4000004fff00005566000000000000000000000000000000000000000000000000000000001999411191149991199009110000000000000000 +004ff40004f44f400077777400005566000000000000000000000000000000000000000000000000000000009669111191149119004441110000000000000000 +0044440004f44f400004466700005566000000000000000000000000000000000000000000000000000000009669111119149191004941110000000000000000 +000000007777777700044ff507777775000000000000000000000000000000000000000000000000000000001991111111999911104441110000000000000000 00000000077777700777777400077777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000046556400077777700055566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000004f55f400004566500055565000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -140,13 +156,14 @@ ffffffff11111111ffffffff1111ffffffff1111111111111111ffffffff11111111111100000000 00000000044ff440000044ff00055566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000004444000000444f00055566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000440000000044400055566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000077777775000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000777777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000055566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000005566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000005566000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000555000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000055000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000077777775000000000000000011111111111111111111111111111111111111110000000000000000000000000000000000000000 +0000000000000000000000000077777700000000000000000077770077777777aaaaaaaa3333333322d22dd20000000000000000000000000000000000000000 +0000000000000000000000000005556600000000000000000077770099999999aa8aa8aa333333332dd22d220000000000000000000000000000000000000000 +0000000000000000000000000000556600000000000000000007700077977977aaa88aaacccccccc22d22dd20000000000000000000000000000000000000000 +0000000000000000000000000000556600000000000000000070070077977977aaa88aaacccccccc2dd22d220000000000000000000000000000000000000000 +0000000000000000000000000000055500000000000000000007700099999999aa8aa8aa3333333322d22dd20000000000000000000000000000000000000000 +0000000000000000000000000000005500000000000000000070070077777777aaaaaaaa333333332dd22d220000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000011111111111111111111111111111111111111110000000000000000000000000000000000000000 __map__ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000