pico-8 cartridge // http://www.pico-8.com version 41 __lua__ -- function _init() start_scene("title") end function _update() if _scene and _scene.update then _scene.update() end end function _draw() if _scene and _scene.draw then _scene.draw() end end function start_scene(name) _scene = _scenes[name] _scene_start = time() if _scene.start then _scene.start() end end function scene_time() return time() - _scene_start end _scene = nil _scenes = {} _scene_start = 0 function draw_title() cls() print("title " .. scene_time()) end function update_title() if scene_time() > 0 then start_scene("ocean") end end _scenes.title = {start=nil, draw=draw_title, update=update_title} function start_ocean() ocean_wind_x = 0 ocean_wind_y = 0 end function draw_ocean() 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() if btn(0) then ocean_wind_x = -1 elseif btn(1) then ocean_wind_x = 1 else ocean_wind_x = 0 end if btn(2) then ocean_wind_y = -1 elseif btn(3) then ocean_wind_y = 1 else ocean_wind_y = 0 end end _scenes.ocean = {start=start_ocean, draw=draw_ocean, update=update_ocean} __gfx__ 11111111111111111111111111111111111111111111111111111111111111111711111111111111111111111111111111111111000000000000000000000000 11111111171111111117111111111711111111171111111111111111111117111111111111111111111111111111111111111111000000000000000000000000 11111111111111111111111111111111111111111111111111111111171111111111711111111111111111111111111111111111000000000000000000000000 11111111111111111111111111111111111111111111111111111711111111111111111111111111111111111111111111111111000000000000000000000000 11111111117111111111171111111117111111111111111117111111111111111111111111111111111111111111111111111111000000000000000000000000 11111111111111111111111111111111111111111111171111111111111171111111111111111111111111111111111111111111000000000000000000000000 11111111171111111117111111111171111111111711111111171111111111111111111111111111111111111111111111111111000000000000000000000000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000 ffffffffffffffff111111111111ffffffff1111ffff111111111111111111111111ffff00000000000000000000000000000000000000000000000000000000 ffffffffffffffff111111111111ffffffff1111fff11111111111111111111111111fff00000000000000000000000000000000000000000000000000000000 ffffffffffffffff111111111111ffffffff1111ff1111111111111111111111111111ff00000000000000000000000000000000000000000000000000000000 ffffffffffffffff111111111111ffffffff1111f111111111111111111111111111111f00000000000000000000000000000000000000000000000000000000 ffffffff11111111ffffffff1111ffffffff1111111111111111111ff11111111111111100000000000000000000000000000000000000000000000000000000 ffffffff11111111ffffffff1111ffffffff111111111111111111ffff1111111111111100000000000000000000000000000000000000000000000000000000 ffffffff11111111ffffffff1111ffffffff11111111111111111ffffff111111111111100000000000000000000000000000000000000000000000000000000 ffffffff11111111ffffffff1111ffffffff1111111111111111ffffffff11111111111100000000000000000000000000000000000000000000000000000000 3333333333333333ffffffffffff33333333ffff3333ffffffffffffffffffffffff333333333333333333333333333333333333000000000000000000000000 3333333333333333ffffffffffff33333333ffff333ffffffffffffffffffffffffff33333333a33333333333333333333333333000000000000000000000000 3333333333333333ffffffffffff33333333ffff33ffffffffffffffffffffffffffff333333333333a3333333a3338333333383000000000000000000000000 3333333333333333ffffffffffff33333333ffff3ffffffffffffffffffffffffffffff333333333333333333333333333333333000000000000000000000000 33333333ffffffff33333333ffff33333333fffffffffffffffffff33fffffffffffffff3a333a33333333333333333333333333000000000000000000000000 33333333ffffffff33333333ffff33333333ffffffffffffffffff3333ffffffffffffff3333333333a3333333a3383333833333000000000000000000000000 33333333ffffffff33333333ffff33333333fffffffffffffffff333333fffffffffffff33333333333333333333333333333333000000000000000000000000 33333333ffffffff33333333ffff33333333ffffffffffffffff33333333ffffffffffff33333333333333333333333333333333000000000000000000000000 5555555555555555ffffffffffff55555555ffff5555ffffffffffffffffffffffff555555555555555555555555555555555555000000000000000000000000 5555555555555555ffffffffffff55555555ffff555ffffffffffffffffffffffffff55555555555559555555555555555555555000000000000000000000000 5555555555555555ffffffffffff55555555ffff55ffffffffffffffffffffffffffff5555555555555555555555555559555555000000000000000000000000 5555555555555555ffffffffffff55555555ffff5ffffffffffffffffffffffffffffff555555555555955955555555555555555000000000000000000000000 55555555ffffffff55555555ffff55555555fffffffffffffffffff55fffffffffffffff55555555555555555555955555555555000000000000000000000000 55555555ffffffff55555555ffff55555555ffffffffffffffffff5555ffffffffffffff55555555555555555595555555555555000000000000000000000000 55555555ffffffff55555555ffff55555555fffffffffffffffff555955fffffffffffff55955555555555955555955555555595000000000000000000000000 55555555ffffffff55555555ffff55555555ffffffffffffffff55555555ffffffffffff55555555555555555555555555555555000000000000000000000000 __map__ 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0016121212121700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0013101010101400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0013101010101400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0018111111111500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000