Files
pico8/watervibes.p8
2025-08-01 11:04:50 +02:00

341 lines
27 KiB
Lua
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

pico-8 cartridge // http://www.pico-8.com
version 42
__lua__
function _init()
--
end
function _draw()
--regular screen palette
pal()
--values 0x10 and 0x30 to 0x3f change the effect
poke(0x5f5f,0x10)
--new colors on the affected line
pal(5,-11,2)
pal(6,-3,2)
pal(13,-14,2)
pal(9,-7,2)
pal(10,-6,2)
--0x5f70 to 0x5f7f are the 16 sections of the screen
--0xff is the bitfield of which of the 16 line of the section are affected
-- memset(0x5f78+0x1*(wl),0xff-(0x1*wl),1)
-- memset(0x5f79+0x1*(wl),0xff,8-(wl))
memset(0x5f80-(wl),up,32)
cls()
rect(0,0,128,128)
rectfill(0,92,128,128,6)
for x=0,2 do
sspr(48,0,32,32,0+(128/2)*x,32,64,64)
end
drawmap()
line(0,128-wl*8,128,128-wl*8,7)
for i=0,8 do
sx=abs(sin(time()/8+i*70))*128
line(sx,128-wl*8,sx+rnd(8),128-wl*8,6)
end
print("press ⬆️ to raise",32,64,8)
fishy:draw()
end
function _update60()
if btnp() then
wl+=1
end
if btnp() then
wl-=1
clearwl()
end
fishy:update()
end
function clearwl()
memset(0x5f70,0x00,32)
end
function drawmap()
map()
for x=0,15 do
for y=0,15 do
if full(x,y) then
left,right=false,false
--left side
if not full(x-1,y) then
sspr(16,0,4,8,x*8,y*8)
left=true
else
--inside corner
if not full(x-1,y+1) then
sspr(24,4,4,4,x*8,y*8+4)
end
if not full(x-1,y-1) then
sspr(24,0,4,4,x*8,y*8)
end
end
--right side
if not full(x+1,y) then
sspr(22,0,4,8,x*8+6,y*8)
right=true
else
if not full(x+1,y+1) then
sspr(28,4,4,4,x*8+4,y*8+4)
end
if not full(x+1,y-1) then
sspr(28,0,4,4,x*8+4,y*8)
end
end
--ground
if not full(x,y-1) then
sspr(8,0,8,5,x*8,y*8)
if right then
sspr(36,0,4,5,x*8+4,y*8)
end
if left then
sspr(32,0,4,5,x*8,y*8)
end
end
--ceiling
if not full(x,y+1) then
sspr(8,5,8,3,x*8,y*8+5)
if right then
sspr(36,5,4,5,x*8+4,y*8+5)
end
if left then
sspr(32,5,4,5,x*8,y*8+5)
end
end
end
end
end
end
-->8
--vars
up=0xff
wl=0 --waterlevel
--helpers
function full(x,y)
return mget(x,y)==5
end
--lerp from x to y over t (t being 0 to 1, 1 being complete)
function lerp(x,y,t)
return x+(y-x)*t
end
-->8
--characters
--fishy
fishy={
x=64,
y=64,
v={x=0,y=0},--velocity
uw=true, --underwater
--fishy:update
update=function(self)
if vw then
self.v.y=lerp(self.v.y,0,.5)
g=0.
else
g=.5
end
self.v.y +=g
tx=lerp(self.x,self.x+self.v.x,.2)
ty=lerp(self.y,self.y+self.v.y,.2)
if not full(fishy.x/8,ty/8) then
self.y=ty
else
self.v.y=0
end
if not full(tx/8,fishy.y/8) then
self.x=tx
else
self.v.x=0
end
end,
--fishy:draw
draw=function(self)
camera(fishy.x-64,fishy.y-64)
spr(0,self.x,self.y)
end,
--fishy:move
move=function(x,y)
end,
}
__gfx__
000000003b3d33b300000000d00000030b3003b05555555500000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000033533b53530000030000000333b005535555555500000000000000000000000000000000000000000000000000000000000000000000000000000000
009999000505300033000006000000003d300d3d5555555500000000000000000000000000000000000000000000000000000000000000000000000000000000
00959500000000000000003100000000550005d35555555500000000000000000000000000000000000000000000000000000000000000000000000000000000
09a9a900000000000000000000000000000000005555555500000000000000000000000000000000000000000000000000000000000000000000000000000000
00999990000000003000000000000000000000005555555500000000000000000000000000000000000000000000000000000000000000000000000000000000
0900900010d00000bd00005330000000000000005555555500000000000000000000000000000000000000000000000000000000000000000000000000000000
00900900dd00d11d0000000010000001100000035555555500000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000006660000000600000000000000000000000000000000000000000000000000
00666600000000000000000000000000000000000000000000000000000000000067766000006660000000000000000000000000000000000000000000000000
00656500000000000000000000000000000000000000000000000000000000000677766600066666000000000000000000000000000000000000000000000000
0666660000000000000000000000000000000000000000006000000000000000667776666066dddd000000000000000000000000000000000000000000000000
0066666000000000000000000000000000000000000000006600000000000006677777666666dddd000000000000000000000000000000000000000000000000
060060000000000000000000000000000000000000000000d660000000000066777777766666dddd000000000000000000000000000000000000000000000000
006006000000000000000000000000000000000000000000dd660000000006677777777776666ddd000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000ddd66000000066777777777777766ddd000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000ddd66700000667777777777777776ddd000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000dddd6670006667777777777777776ddd000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000ddddd6670667777766777777777766dd000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000dddddd667677776666666677777766dd000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000ddddddd777777666666666666777666d000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000ddddd677776666666666666667766666000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000ddddd767766666666666666666766666000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000dddd7666666666666666666666766666000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000ddd76666666666666666666666766666000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000dd766666666666666666666666666666000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000d7666666666666666666666666666666000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000076666666666666666666666666666666000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000066666666666666666666666666666666000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000066666666666666666666666666666666000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000066666666666666666666666666666666000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
60606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
__map__
0505050505050505050505050505050606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000005050000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000005050000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000050000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000005050505050505000000050000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000050000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000050000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000050000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000000000000000000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0500000000000005050505050500000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0505050505050505000005050000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0000000000000000000000000000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0000000000000000000000000000000000000000000000000006060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606
0606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606