commit 0973fd48e92f8ad233b9459762aef5a508c49e30 Author: bvanroll Date: Fri Jul 25 11:46:41 2025 +0200 initial commit diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..7f651bd Binary files /dev/null and b/.DS_Store differ diff --git a/alain_example.p8 b/alain_example.p8 new file mode 100644 index 0000000..dca1514 --- /dev/null +++ b/alain_example.p8 @@ -0,0 +1,284 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ +--example with time +-- player object +p={ +x=8, +y=8, +w=6, +h=6, +d=true, +bucket=0, +debug="", +--draw function that also displays debug msgs. don't do this, set debug outside of player +draw=function(self) + print(self.debug) + self.debug = "" + spr(13-self.bucket,0,120) + spr(0,self.x,self.y) +end, +--move and collision combined in one function +move=function(self, x, y) +cx=self.x+(x*(1.5-(self.bucket/5))) +cy=self.y+(y*(1.5-(self.bucket/5))) +-- based on https://gamedev.docrobs.co.uk/first-steps-in-pico-8-easy-collisions-with-map-tiles +collide = false +cand={} +for i=cx,cx+self.w,self.w do + if fget(mget(i/8,cy/8),0) or fget(mget(i/8,(cy+self.h)/8),0) then + collide = true + add(cand,mget(i/8,cy/8,0)) + add(cand,mget(i/8,(cy+self.h)/8)) +-- self.debug = self.debug.."why" + end +end +for i=cy,cy+self.h,self.h do + if fget(mget(cx/8,i/8),0) or fget(mget((cx+self.w)/8,i/8),0) then + collide = true + add(cand,mget(cx/8,i/8,0)) + add(cand,mget((cx+self.w)/8,i/8)) +-- self.debug = self.debug.."why" + end +end +if not collide then + self.x = cx + self.y = cy +else + for v in all(cand) do + self.debug = self.debug..v + if fget(v,2) do + --empty bucket + self.bucket = 0 + elseif fget(v,7) do + --fill bucket + self.bucket +=b.s + r=0 + if self.bucket > 5 then + b.s = self.bucket - 5 + self.bucket = 5 + else + b:move() + end + end + end +end +camera(-64+self.x, -64+self.y) +end +} + +--bucket object? +b={ +x=16, +y=48, +s=0, +draw=function(self) +--spr(14-self.s,self.x,self.y) +mset(self.x/8,self.y/8,14-self.s) +end, +update=function(self,t) +self.s +=t +if (self.s>5) then +e=true +self.s = 5 +end +end, +move=function(self) +repeat +x=rnd(128) +y=rnd(64) +until not (fget(mget(x/8,y/8),0)) or (fget(mget(x/8,y/8),1)) +mset(self.x/8,self.y/8,1) +self.x = x +self.y = y +self.s = 0 +end +} + +e = false +win=false + +function _init() +stime = stat(95)+stat(94)*60 +t=time() +camera() +end + +function _update() +t=time()*5 +-- using modulo operator to loop action through time +y=t % 16 - 8 +--p.debug = p.debug..y +if (y > 0) then +mset(5,1+y,2) +else +mset(5,1+8+y,7) +end + +x=0 +y=0 +if(btn(⬅️))x-=2 +if(btn(➡️))x+=2 +if(btn(⬇️))y+=2 +if(btn(⬆️))y-=2 +p:move(x,y) +b:update(.025) + +end + + + +function _draw() +cls() +if false then +print("you lost") +else +map(0,0,0,0,32,32) +p:draw() +b:draw() +end +end +__gfx__ +0000000044444444cccccc1c22222222000aa000444444444cccc7c4455222544444444457ccccc5500000055000000550000005500000050000000000b00000 +0111111045449444c6cc7ccc282222821aaaaaaa441111444cccccc445222c54451111145ccc7cc550000005500000055000000550000005000000000b000000 +0171171044444444c6cccccc22888822a1aaaaaa44cccc4444c6cc444522225441ccc5145cccccc55cccc7c550000005500000055000000500000000b0000000 +0117711044444444cccccccc22888822aa1aaa1a44cccc4444c6cc444525225441c7c61405ccc150056ccc5005c07050050000500500005000000000bbbbbbbb +0117711045444445ccccc61c22888822aaa1a1aa4cc6c16444c6c7444522225441ccd61505cccc50051cc15005cccc50050000500500005000000000b0000000 +0171171045449444cccccccc22888822aaaa1aa14c6cccc4446ccc444522245441cccc1405cccc5005ccc15005cccc5005cc7c5005000050000000000b000000 +0111111044944454cc7ccccc28222282a11aa1114c7cc6c44411114445212254411111140051c500005cc500005cc500005cc500005005000000000000b00000 +0000000044444444cccccccc22222222000aa00046ccc6c444444444452221544444444400555500005555000055550000555500005555000000000000000000 +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 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +30303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +30303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +30303010303010303030301030301030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +20201020103030301010301010303010303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10102010101010102010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +10101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__gff__ +0000010102010102058181818181000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__map__ +0303030303050303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0301010101020101010101010101010303030101010103030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0301080101020101010101010101010101010101010103030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0301010101020101010101010101010101010101010103030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303020303030303010101010303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0301010101020101010101010101010303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0301010101020101010101010101010101010101010101010103030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0301010101020101010303010101010101010101010101010103030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0301010101020101010101010101010103010101010101010303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303020303030303010101030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303060303030303010101030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0103030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030303030303030303030303030303030303030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/alphabet.p8 b/alphabet.p8 new file mode 100644 index 0000000..d1d5b96 --- /dev/null +++ b/alphabet.p8 @@ -0,0 +1,19 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000004000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000 +00700700004444000040000000000000000004000044440000444400004444000040000000400000000000000040040000400000040004000000000000444400 +00077000004004000040000000000000004444000040000000400000004000000040040000000000000040000040400000400000044044000040040000400400 +00077000004004000044440000444400004004000044440000444000004000000040040000400000000040000044000000400000040404000044040000400400 +00700700004444000040040000400000004004000040000000400000004044000044440000400000000040000040400000400000040004000040440000400400 +00000000004004000040040000400000004004000040000000400000004004000040040000400000000040000040040000400000040004000040040000400400 +00000000004004000044440000444400004444000044440000400000004444000040040000400000004400000040040000444400040004000040040000444400 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000004444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00444000004004000044440000444000044444000040040004400040040000440440000004400400000000000000000000000000000000000000000000000000 +00404000004004000040040000400000000400000040040000400440040440400044044000440400004444000000000000000000000000000000000000000000 +00444000004044000044440000400000000400000040040000440400040444400004400000040400000004000000000000000000000000000000000000000000 +00400000004444400040400000444400000400000040040000044400040404400044440000004400000040000000000000000000000000000000000000000000 +00400000000004000040040000000400000400000044040000004000004404000440044000004000000400000000000000000000000000000000000000000000 +00400000000000000040040000444400000400000004440000004000004404000000004000044000004444000000000000000000000000000000000000000000 diff --git a/creature.p8 b/creature.p8 new file mode 100644 index 0000000..71c1419 --- /dev/null +++ b/creature.p8 @@ -0,0 +1,671 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ +--main + + +-- notes about memory layout +--0 is flag if time has +--been set yet + +--1 is the start date i think + +--2 is the start time i think + +--10 and onward gonna use +--for persistent storage of +--the kid stuff + +--10 is the modifier + +function _init() + printh("init") + + cartdata("savedgame") + timeset = dget(0) + stime=dt:new() + + if (timeset==0) then + stime:from(currenttime()) +-- printh("save:"..stime:tostring()) + stime:save() + else + stime:read() +-- printh("read:"..stime:tostring()) +-- printh("starttime = ".. ) + end + + cls() +-- printh("goaltime"..goaltime) + m:draw() + ui:draw() + +end + +function _update60() + ctime=dt:new() + m:update() + ctime:from(currenttime()) + if (btn(⬆️)) and + (btn(⬇️)) and + (btn(⬅️)) and + (btn(➡️)) and + (btn(❎)) and + (btn(🅾️)) then + dset(10,0) --reset kid state + dset(0,0) --reset timesaved flag +-- printh("save reset") + end + + k:update(stime,ctimed) + k:save() + state[stated]:update() +end + +function _draw() + state[stated]:draw() +end +-->8 +--npc +p = { --player + hmap={}, + x=64, + y=64, + w=4, + h=7, + dx=0, + dy=0, + xv = 0, + yv = 0, + s=1, + xo=2, + draw = function(self) + if (self.dy>0) then + printh(self.dy) + s=193 + elseif (self.dy<0) then + printh(self.dy) + s=194 + elseif (self.dx>0) then + printh(self.dx) + s=196 + elseif (self.dx<0) then + printh(self.dx) + s=195 + else + s=192 + end + spr(s,self.x,self.y+((time()*2%2))) + end, + input = function(self, xv, yv) + self.dx=xv + self.dy=yv + + self.xv = xv + self.yv = yv + end, + move = function(self) + if not (hitx(self.x+self.xv+self.xo,self.y,self.w,self.h)) then + self.x+= self.xv + end + if not (hity(self.x+self.xo,self.y+self.yv,self.w,self.h)) then + self.y+= self.yv + end + end +} + +k={ --him + s=1, + x=196, + y=64, + m=1, --modifier + t = 0, + speed=.1, + target={x=-1,y=-1}, + mv=function(self) + local bdst,bx,by =32000,0,0 + for i=1,4 do + local dx,dy=dirx[i]+self.x,diry[i]+self.y + if (not shit(dx,dy,0)) then + d=dist(dx/8,dy/8,p.x/8,p.y/8) + if dself.speed) xdir=self.speed*sgn(xdir) + self.x+=bx*self.speed +-- ydir=self.target.y-self.y +-- printh("ydir:"..ydir) +-- if (abs(ydir)>self.speed) ydir=self.speed*sgn(ydir) + self.y+=by*self.speed + + end, + growtime=3.600, + update = function(self,start,current) + self.m = dget(10) --get last m + temp = tts() + self.t=temp-self.m + if (self.t<0) then + self.t=0 + self.m=0 + dset(10,self.m) + end + pa = self.t/self.growtime + if (self.t8 +--map +m = { --map + cx=0,--camera x + cy=0,--camera y + --camera velocity + cvx=0, + cvy=0, + --target x and y + tx=0, + ty=0, + t=false,--transition + update= function(self) + tile = (mget(p.x/8,p.y/8)) + f=fget(tile) + if (f>1) then + + self.t = true + if ((f & 0x2)!=0) then + --n + self.cy-=128 + p.y-=16 + elseif ((f&0x4)!=0) then + --e + self.cx+=128 + p.x+=16 + elseif ((f&0x8)!=0) then + --s + self.cy+=128 + p.y+=16 + else + --w + self.cx-=128 + p.x-=16 + end + else + self.t=false + + end + end, + draw = function(self) + cls() + camera(self.cx,self.cy) + map() + end + +} + + +dt = { + s=0, + m=0, + h=0, + d=0, + mo=0, + y=0, + tostring= + function(self) + return self.s..":" + ..self.m..":" + ..self.h.." " + ..self.d.."-" + ..self.mo.."-" + ..self.y + end, + + from=function(self, obj) + self.s = obj.s + self.m = obj.m + self.h = obj.h + self.d = obj.d + self.mo = obj.mo + self.y = obj.y + end, + save=function(self) +-- dset(1,self:dat()) +-- dset(2,self:tim()) + dset(0,1) + dset(1, self.s) + dset(2, self.m) + dset(3, self.h) + dset(4, self.d) + dset(5, self.mo) + dset(6, self.y) + end, + read=function(self) + self.s=dget(1) + self.m=dget(2) + self.h=dget(3) + self.d=dget(4) + self.mo=dget(5) + self.y=dget(6) + end, + dat=function(self) + return self.y*10+self.mo/10+self.d/1000 + end, + tim=function(self) + return self.h*100+self.m+self.s/100 + end, + tdiff=function(self,obj) + return self:tim()-obj:tim() + end, + ddiff=function(self,obj) + return self:dat()-obj:dat() + end + +} + + +function dt:new(obj) + obj = obj or {} + setmetatable(obj, {__index = self}) + return obj +end +-->8 +-- functions + +--distance based on pytho +function dist(x1,y1,x2,y2) + local dx,dy=x1-x2,y1-y2 +-- printh("x1: "..x1.."y1: "..y1) +-- printh("x2: "..x2.."y2: "..y2) +-- printh(x1 .. yb1 ..x2 ..y2) + f=(dx*dx+dy*dy) + return f +end + +--shit (simple hit :) ) +function shit(x,y,z) + return fget(mget(x/8,y/8),z) +end + +-- check hit on top or bottom +function hity(x,y,w,h) --check hit on top or bottom + hit=false + for i=x,x+w do + tile1=mget(i/8,y/8) + tile2=mget(i/8,(y+h)/8) + if (fget(tile1,0)) then + hit=true + elseif (fget(tile2,0)) then + hit=true + end + end + return hit +end +--check hit on sides +function hitx(x,y,w,h) --check hit on sides + hit = false + for i=y,y+h do + tile1=mget(x/8,i/8) + tile2=mget((x+w)/8,i/8) + if (fget(tile1,0)) then + hit=true + elseif (fget(tile2,0)) then + hit=true + end + end + return hit +end + + +-- returns the current time. +--i have to split it up fml +function currenttime() + + t = { + s=stat(95), + m=stat(94), + h=stat(93), + d=stat(92), + mo=stat(91), + y=stat(90) + } + return t +end + +--timetosec +function tts() + temp = (ctime.s-stime.s)/1000 + temp += (ctime.m-stime.m)*.06 + temp += (ctime.h-stime.h)*3.6 + temp += (ctime.d-stime.d)*86.4 + temp += (ctime.mo-stime.mo)*1036.8 + if (temp > 32767.99) + or ((ctime.y-stime.y)>0) + then + stated = 3 --game over + end + + + return temp +end +-->8 +--state + +state={ +{--1 menu +update=function(self) +--pause toggle + if (btnp(❎)) then + stated=2 + end +end, +draw=function(self) + ui:draw() + +end +}, +{--2 gameplay +update=function(self) +-- if (btn(🅾️)) printh(ctime:tostring()) + xv = 0 + yv = 0 + if (btn(➡️)) xv+=p.s + if (btn(⬅️)) xv-=p.s + if (btn(⬆️)) yv-=p.s + if (btn(⬇️)) yv+=p.s + p:input(xv,yv) + p:move() + + + --pause toggle + if (btnp(❎)) then + stated=1 + end +end, + +draw=function(self) + m:draw() + p:draw() + k:draw() +end +}, +{ --3 game over +update=function(self) + +end, +draw=function(self) +cls() +print("you lose... the creature grew too much") +print("hold ⬆️⬇️⬅️➡️❎🅾️ to reset save") +end, +}, +{--4 intro +update=function(self) + if (btnp(❎)) stated=2 +end, +draw=function(self) +cls() +x=rnd(2) +y=rnd(2) +if (timeset==0) then + print("the is growing",0,0,7) + print("creature",x+16,y+1,2) + print("creature",x+16,y,8) + +else + print("the growth never stops",0,0,7) + print("creature's",x+16,y+1,2) + print("creature's",x+16,y,8) + +end +print(" seeks comfort.",0,8,7) +print("it",x,7+y,2) +print("it",x,8+y,8) +print("find .",0,16,7) +print("it",x+18,15+y,2) +print("it",x+18,16+y,8) +print("soothe .",0,24,7) +print("it",x+27,23+y,2) +print("it",x+27,24+y,8) + + +print("pres x to continue",0,80,7) +print(k.t) +end, + +} +} +-->8 +--ui + +ui = { + elements={ + kidgrowth={ + text="-his- growth%: ", + x=40, + y=64, + c=7, --color + w=20, + h=20, + draw=function(self) + print(self.text..k.t/k.growtime*100,self.x, self.y, self.c) + end + }, + kidalive={ + text="your kid's been alive for: ", + x=0, + y=4, + c=7, --color + w=20, + h=20, + draw=function(self) + print(self.text,self.x, self.y, self.c) + print(k.t.."s",self.x, self.y+8, self.c) + end + }, + testing={ + text="-his- state: ", + x=40, + y=72, + c=7, --color + w=20, + h=20, + draw=function(self) + print(self.text..k.m,self.x, self.y, self.c) + end + } + }, + draw= function(self) + cls()--clear screen + camera() --reset the camera to default pos + rectfill(0,0,128,128,1) + for k,v in pairs(self.elements) do + v:draw() + end + + end +} +-->8 +--global vars +stated=4 +twodays=172800 +timescale=1 +stime={} +ctime={} +timeset=0 +mapbounds={ +x1=0, +y1=0, +x2=47, +y2=31 +} +--via lazydevs +dirx={-1,1,0,0,1,1,-1,1} +diry={0,0,-1,1,-1,1,1,-1} +__gfx__ +00000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000001111110166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000011110001611610166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000110000011610001612610166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000110000011110001111110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000011110001211110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000001111110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222555555555555555555555554555555554444444455555555555444445555555544445555000000000000000000000000000000000000000000000000 +2222222256dddd655555555555555554555555555555555555555555555444445555555544445555000000000000000000000000000000000000000000000000 +222222225dddddd55555555555555554555555555555555555555555555444445555555544445555000000000000000000000000000000000000000000000000 +222222225dddddd55555555555555554555555555555555544444555555444445555555544445555000000000000000000000000000000000000000000000000 +222222225dddddd55555555555555554555555555555555544444555555444445554444455555555000000000000000000000000000000000000000000000000 +222222225dddddd55555555555555554555555555555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +2222222256dddd655555555555555554555555555555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +22222222555555555555555555555554444444445555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +22222222007777002222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222007777002222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222077cc7702211112222111122221111222211112200000000000000000000000000000000000000000000000000000000000000000000000000000000 +2222222207cccc702212212222122122221221222212212200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222077777702212212222122122221221222212212200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222077777702211112222111122221111222211112200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222077777702222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222007777002222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000dddd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000dddd000dddd000dddd0000000000000dddd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000dddd000dddd000dddd00000dddd0000dddd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000dddd0000dd0000dddd00000dddd0000dddd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000dd00000dd00000dd000000dddd00000dd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000dd00000d000000dd0000000dd000000dd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000d0d000000000000d0d000000dd000000dd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +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 +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 +0000000000dddd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00dddd0000dddd00000000000dddd000000dddd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00dddd0000dddd0000dddd000dddd000000dddd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00dddd00000dd00000dddd000dddd000000dddd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000dd000000dd00000dddd0000dd00000000dd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000dd000000d0000000dd00000dd00000000dd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000dd00000000000000dd00000d0d000000d0d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__gff__ +0000000000000000000000000000000000010101010101010101000000000000000002040810000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__map__ +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111110101010111111111111111111111111111010101011111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111124242424111111111111111111111111112424242411111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111122222222111111111111111111111111112222222211111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111110101010111111111111111111111111111010101011111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010111111111111111110101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__sfx__ +000200000251002510085103a310363202c3201f3300f33039330263302131014420032200b2203042034220184202422016420164200352021520194202e52013520174200c5300742008420014201151000000 +000200000a3200a3200a3200a3200a3200a3200a3100b3100c3100d3100f310113101231015310183101c3201f3201e2202023021230202301f2301e2201c2201b2221a6221762215620146200a6200062000000 +000200000437004370043700437004360043600436004360043600936009360083600837007370063700637006370063700637005370053700537004370043700436004360053700537005370000700000000000 diff --git a/demos/api.p8 b/demos/api.p8 new file mode 100644 index 0000000..c1e802b --- /dev/null +++ b/demos/api.p8 @@ -0,0 +1,398 @@ +pico-8 cartridge // http://www.pico-8.com +version 30 +__lua__ +-- api.p8 by zep +-- demos most api functions + +-- _draw() called once per frame +function _draw() + + -- clear screen to dark blue + cls(1) + + -- ❎: mess with camera / clipping + camera() -- reset + if (btn(❎)) then + camera(cos(t()/6)*20,0) + clip(4,16,120,96)--x,y,w,h + end + + -- draw whole map + map() + + -- circles x,y,radius,col + circfill(64,160,63,6) + circ(64,160,67,14) + + -- with fill pattern + fillp(░) + circfill(64,160,52,7) + fillp() -- reset + + -- rectangles x0,y0,x1,y1,col + rectfill(4,4,124,10,0) + rect(2,2,126,12,0) + + -- lines: x0,y0,x1,y1,col + -- (palette at top) + for i=1,15 do + line(i*8-1, 6, i*8+1, 8, i) + end + + -- strings + + num=8 + str="hello " + str..="from api.p"..num + str_len=#str + + -- print: str,x,y,col + print(str, 64-str_len*2, 20, 7) + + -- tables / arrays + + tbl={"a"} -- single element + + add(tbl,"b") -- add to end + add(tbl,"d") + add(tbl,"c") + del(tbl,"d") --remove by value + + -- iterate over the table + -- (draw letters bottom left) + cursor(2,104,5) -- x,y,col + foreach(tbl,print) + + -- another way to iterate + cursor(123,104,5) + for i in all(tbl) do + print(i) + end + + -- iterate with a for loop + -- starts at index 1! (not 0) + tbl={"ヒ゜","コ","◆"} + + for i=1,#tbl do + print(tbl[i],2, 10+i*6,13) + print(tbl[i],114,10+i*6,13) + end + + + -- draw sprites + palt(2,true) --draw transparent + palt(0,false)--draw solid (eyes) + spr(2,48,32,4,4) + + -- stretched sprites + -- (spinning bunnys) + + -- w: width to draw + -- (1 turn ever 2 seconds) + w = cos(t()/2) * 32 + + -- draw back sides indigo + if (w < 0) pal(7,13) + + --[[ + sspr: stretch sprite + ■ first 4 parameters specify + the source rect (x,y,w,h) + ■ last 4 params specify the + rectangle to draw (x,y,w,h) + --]] + sspr(16,0,32,32, + 24-w/2,32,w,32) + -- re-use w to mean height + -- for vertical spinning + sspr(16,0,32,32, + 88,48-w/2,32,w) + + pal() -- reset palette + + -- rotating star sprites + for i=0,31 do + + -- angle based on time + local a=(i+t()*2)/32 + + -- screen position + sx=64 +cos(a)*57 - 4 + sy=160+sin(a)*57 - 4 + + -- grab pixels from spritesheet + -- to use as color + ssx = 64+i%16 -- x location + col=sget(ssx,0) -- grab it + + -- draw star in that color + pal(7,col) -- (remap white) + spr(16, sx,sy) + + end + pal() -- reset + + -- draw state of buttons + for pl=0,7 do + for b=0,7 do + sx=57+b*2 + sy=70+pl*2 + col=5 + if (btn(b,pl)) col=b+7 + pset(sx,sy,col) + end + end + +end + +-- _update(): called 30 fps +-- (use _update60 for 60fps) +function _update() + + -- button pressed: play a sfx + if (btnp(🅾️)) then + sfx(0) + end + +end + +-- _init() called once at start +function _init() + + -- music loops every 4 patterns + -- because the loop-back flag + -- is set on pattern 3 + music(0) + + -- make a custom menu item + menuitem(1, "play sfx", + function() + sfx(3) + end + ) + +end + +__gfx__ +00000000000000002222222222222222222222222222222200000dddddd00000ddd877eeecccdd55000000000000000000000000000000000000000000000000 +000000000000000022222222222222222222222222222222000dddddddddd0000000000000000000000000000000000000000000000000000000000000000000 +00700700000000002222222222222222222222222222222200dddddddddddd000000000000000000000000000000000000000000000000000000000000000000 +0007700000000000222222777722222222222277772222220dddddddddddddd00000000000000000000000000000000000000000000000000000000000000000 +0007700000000000222227777772222222222777777222220dddddddddddddd00000000000000000000000000000000000000000000000000000000000000000 +007007000000000022227777777722222222777777772222dddddddddddddddd0000000000000000000000000000000000000000000000000000000000000000 +000000000000000022227778877722222222777bb7772222dddddddddddddddd0000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222778877772222222277bb77772222dddddddddddddddd0000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222778779772222222277b77c772222dddddddd000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000222277779977222222227777cc772222dddddddd000000000000000000000000000000000000000000000000000000000000000000000000 +000070000000000022227779977722222222777cc7772222dddddddd000000000000000000000000000000000000000000000000000000000000000000000000 +00777770000000002222779977772222222277cc77772222dddddddd000000000000000000000000000000000000000000000000000000000000000000000000 +0007770000000000222277977a772222222277c77e772222dddddddd000000000000000000000000000000000000000000000000000000000000000000000000 +000707000000000022227777aa77222222227777ee772222dddddddd000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777aa77722222222777ee7772222dddddddd000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000222277aa77772222222277ee77772222dddddddd000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777777777777777777777777222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777777777777777777777777222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777777777777777777777777222200d00000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000222277777777777777777777777722220d6d0000000600000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777777777777777777777777222200d00000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777777777777777777777777222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777007777777777777700777222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777007777777777777700777222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777007777777777777700777222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222777777777777777777777777222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222277777777777777777777772222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222277777777770077777777772222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222227777777777777777777722222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222222277777777777777772222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000002222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222222222222222222222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222222222222222222222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222222222222222222222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222227777222222222277772222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222277777722222222777777222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777777772222227777777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +2222277788777222222777bb77722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +222227788777722222277bb777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +222227787797722222277b77c7722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777799772222227777cc7722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +2222277799777222222777cc77722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +222227799777722222277cc777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +2222277977a7722222277c77e7722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +222227777aa772222227777ee7722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777aa777222222777ee77722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +2222277aa777722222277ee777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777777777777777777777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777777777777777777777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777777777777777777777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777777777777777777777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777007777777777770077722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777007777777777770077722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777007777777777770077722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222777777777777777777777722222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222277777777777777777777222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222277777777700777777777222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222227777777777777777772222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222277777777777777222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222222222222222222222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222222222222222222222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222222222222222222222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222222222222222222222222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__label__ +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 +11011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101 +11010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101 +11010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101 +1101000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f00000101 +11010000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f0000101 +110100000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f000101 +11010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101 +11010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101 +11011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101 +11000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11dd11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111dd111 +111d111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d111 +111d111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d111 +111d111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d111 +11ddd1111111111111111111111111717177717111711117711111777177711771777111117771777177711111777177711111111111111111111111111ddd11 +11111111111111111111111111111171717111711171117171111171117171717177711111717171711711111171717171111111111111111111111111111111 +11ddd1111111111111111111111111777177117111711171711111771177117171717111117771777117111111777177711111111111111111111111111ddd11 +1111d111111111111111111111111171717111711171117171111171117171717171711111717171111711111171117171111111111111111111111111111d11 +11ddd1111111111111111111111111717177717771777177111111711171717711717111117171711177711711711177711111111111111111111111111ddd11 +11d111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d1111 +11ddd1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111ddd11 +11111111111111111116111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11ddd1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111ddd11 +1111d111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d11 +111dd11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111dd11 +1111d111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d11 +11ddd1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111ddd11 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d11111111111111111111111111111 +111111111111111111dd1111111dd11111111111111111111111117777111111111111777711111111111111111111111d6d1111111111111111111111111111 +11111111111111111dddd11111dddd11111111111111111111111777777111111111177777711111111111111111111111d11111111111111111111111111111 +1111111111111111ddddd11111ddddd1111111111111111111117777777711111111777777771111111111111111111111111111111111111111111111111111 +1111111111111111ddbdd11111dd8dd1111111111111111111117778877711111111777bb7771111111111111111111111111111111111111111111111111111 +1111111111111111dddbd11111dd8dd111111111111111111111778877771111111177bb777711111111111111111111dddddddddddddddd1111111111111111 +1111111111111111dddbd11111d9ddd111111111111111111111778779771111111177b77c7711111111111111111dddddddddd00dddddddddd1111111111111 +1111111111111111ddcdd11111d9ddd11111111111111111111177779977111111117777cc7711111111111111111dddddddddddddddddddddd1111111111111 +1111111111111111ddcdd11111dd9dd1111111111111111111117779977711111111777cc7771111111111111111ddd00dddddddddddddd00ddd111111111111 +1111111111111111dddcd11111dd9dd111111111111111111111779977771111111177cc77771111111111111111ddd00dddddddddddddd00ddd111111111111 +1111111111111111dddcd11111daddd11111111111111111111177977a771111111177c77e771111111111111111dddddddddddddddddddddddd111111111111 +1111111111111111ddedd11111daddd1111111111111111111117777aa77111111117777ee771111111111111111dddddddddddddddddddddddd111111111111 +1111111111111111ddedd11111ddadd111111111111111111111777aa77711111111777ee7771111111111111111dddddddddddddddddddddddd111111111111 +1111111111111111ddded11111ddadd11111111111111111111177aa77771111111177ee77771111111111111111dddddddddddddddddddddddd111111111111 +1111111111111111ddddddddddddddd1111111111111111111117777777777777777777777771111111111111111dddaaddd11111111dddeeddd111111111111 +1111111111111111ddddddddddddddd1111111111111111111117777777777777777777777771111111111111111dd9ddadd11111111ddcddedd111111111111 +1111111111111111ddddddddddddddd1111111111111111111117777777777777777777777771111111111111111ddd99ddd11111111dddccddd111111111111 +1111111111111111ddddddddddddddd1111111111111111111117777777777777777777777771111111111111111dddd99dd11111111ddddccdd111111111111 +1111111111111111ddddddddddddddd1111111111111111111117777777777777777777777771111111111111111dd88dddd11111111ddbbdddd111111111111 +1111111111111111ddddddddddddddd1111111111111111111117777777777777777777777771111111111111111dddddddd11111111dddddddd111111111111 +1111111111111111dd0ddddddddd0dd11111111111111111111177700777777777777770077711111111111111111dddddd1111111111dddddd1111111111111 +1111111111111111dd0ddddddddd0dd1111111111111111111117770077777777777777007771111111111111111111111111111111111111111111111111111 +1111111111111111dd0ddddddddd0dd1111111111111111111117770077777777777777007771111111111111111111111111111111111111111111111111111 +1111111111111111ddddddddddddddd1111111111111111111117777777777777777777777771111111111111111111111111111111111111111111111111111 +11111111111111111ddddddddddddd11111111111111111111111777777777777777777777711111111111111111111111111111111111111111111111111111 +11111111111111111dddddd0dddddd11111111111111111111111777777777700777777777711111111111111111111111161111111111111111111111111111 +111111111111111111ddddddddddd111111111111111111111111177777777777777777777111111111111111111111111111111111111111111111111111111 +1111111111111111111ddddddddd1111111111111111111111111111777777777777777711111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d11111 +1111111111111111111111111111111111111111111111111116111111111111111111111111111111111111111111111111111111111111111111111d6d1111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111d11111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111151515151515151511111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111151515151515151511111dddddd111111111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111111dddddddddd1111111111111111111111111111111111111111111 +1111111111d111111111111111111111111111111111111111111111151515151515151511dddddddddddd111111111111111111111111111111111111111111 +111111111d6d1111111111111111111111111111111111111111111111111111111111111dddddddddddddd11111111111111111111111111111111111111111 +1111111111d11111111111111111111111111111111111111111111115151515151515151dddddddddddddd11111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111dddddddddddddddd1111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111515151515151515dddddddddddddddd1111111111111111111111111111111111111111 +111111111111111111111111111111111111111111111111111111111111111111111111dddddddddddddddd1111111111111111111111111111111111111111 +111111111111111111111dddddd1111111111111111111111111111115151515151515d5ddddddddddddddddddd11111111111111111111111111dddddd11111 +1111111111111111111dddddddddd11111111111111111111111111111111111111dddddddddddddddddddddddddd1111111111111111111111dddddddddd111 +111111111111111111dddddddddddd111111111111111111111111111515151515d5d5d5dddddddddddddddddddddd11111111111111111111dddddddddddd11 +11111111111111111dddddddddddddd1111111111111111111111111111111111dddddddddddddddddddddddddddddd111111111111111111dddddddddddddd1 +11111111111111111dddddddddddddd11111111111111111111111111515151515d5d5d5ddddddddddddddddddddddd111111111111111111dddddddddddddd1 +1111111111111111dddddddddddddddd11111111111111111111111111111111dddddddddddddddddddddddddddddddd1111111111111111dddddddddddddddd +1111111111111111dddddddddddddddd11111111111111111111111111111111dddddddddddddddddddddddddddddddd1111111111111111dddddddddddddddd +1111111111111111dddddddddddddddd11111111111111111111111111111111dddddddddddddddddddddddddddddddd1111111111111111dddddddddddddddd +1111111111111dddddddddddddddddddddd11111111111111111111111111dddddddddddddddddddddddddddddddddddddd1111111111ddddddddddddddddddd +11111111111dddddddddddddddddddddddddd1111111111111111111111dddddddddddddddddddddddddddddddddddddddddd111111ddddddddddddddddddddd +1111111111dddddddddddddddddddddddddddd11111111111111111111dddddddddddddddddddddddddddddddddddddddddddd1111dddddddddddddddddddddd +111111111dddddddddddddddddddddddddddddd111111111111111111dddddddddddddddddddddddddddddddddddddddddddddd11ddddddddddddddddddddddd +111111111dddddddddddddddddddddddddddddd111111111111111111dddddddddddddddddddddddddddddddddddddddddddddd11ddddddddddddddddddddddd +11111111dddddddddddddddddddddddddddddddd1111111111111111eeeeeeeeeeeeeeeeeddddddddddddddddddddddddddddddddddddddddddddddddddddddd +11111111dddddddddddddddddddddddddddddddd1111111111eeeeeedddddddddddddddddeeeeeeddddddddddddddddddddddddddddddddddddddddddddddddd +11111111dddddddddddddddddddddddddddddddd111111eeee111111dddddddddddddddddddddddeeeeddddddddddddddddddddddddddddddddddddddddddddd +11111ddddddddddddddddddddddddddddddddddddddeee1111111ddddddddddddddddddddddddddddddeeedddddddddddddddddddddddddddddddddddddddddd +111dddddddddddddddddddddddddddddddddddddeeedd111111dddddd666666666666666ddddddddddddddeeeddddddddddddddddddddddddddddddddddddddd +11ddddddddddddddddddddddddddddddddddddeedddddd1111d666666666666666666666666666dddddddddddeeddddddddddddddddddddddddddddddddddddd +1dddddddddddddddddddddddddddddddddddeeddddddddd66666666666666666666666666666666666dddddddddeeddddddddddddddddddddddddddddddddddd +1dddddddddddddddddddddddddddddddddeedddddddd66666666666666666666666666666666666666666ddddddddeeddddddddddddddddddddddddddddddddd +ddddddddddddddddddddddddddddddddeeddddddd666666666666666666e6666666666e66666666666666666dddddddeeddddddddddddddddddddddddddddddd +ddddddddddddddddddddddddddddddeeddddddd666666666666666666eeeee666666eeeee66666666666666666dddddddeeddddddddddddddddddddddddddddd +ddddddddddddddddddddddddddddeeddddddd66666666666e666666666eee66666666eee66666666676666666666dddddddeeddddddddddddddddddddddddddd +dd555ddddddddddddddddddddddeddddddd66666666666eeeee6666666e6e66666666e6e6666666777776666666666dddddddeddddddddddddddddddddd555dd +dd5d5dddddddddddddddddddddedddddd66666666666666eee6666666666666666666666666666667776666666666666ddddddedddddddddddddddddddd5d5dd +dd555dddddddddddddddddddeeddddd6666666666666666e6e666666666666666666666666666666767666666666666666dddddeedddddddddddddddddd555dd +dd5d5ddddddddddddddddddedddddd66666666c666666666666666666666666666666666666666666666666666666666666ddddddeddddddddddddddddd5d5dd +dd5d5dddddddddddddddddeddddd66666666ccccc666666666666666666676667666766666666666666666666667666666666dddddedddddddddddddddd5d5dd +ddddddddddddddddddddeeddddd6666666666ccc66666666666666766676667666766676667666666666666667777766666666dddddeeddddddddddddddddddd +dd555ddddddddddddddedddddd66666666666c6c666666666666766676667666766676667666766666666666667776666666666ddddddeddddddddddddd555dd +dd5d5dddddddddddddeddddd666666666666666666666676667666766676667666766676667666766676666666767666666666666dddddedddddddddddd5d5dd +dd55dddddddddddddeddddd66666666666666666666676667666766676667666766676667666766676667666666666666666666666dddddeddddddddddd55ddd +dd5d5dddddddddddeddddd666666c666666666666676667666766676667666766676667666766676667666766666666666666666666dddddedddddddddd5d5dd +dd555ddddddddddeddddd66666ccccc66666666676667666766676667666766676667666766676667666766676666666666668666666dddddeddddddddd555dd +ddddddddddddddeddddd6666666ccc6666666676667666766676667666766676667666766676667666766676667666666668888866666dddddeddddddddddddd +ddd55ddddddddeddddd66666666c6c66666676667666766676667666766676667666766676667666766676667666766666668886666666dddddedddddddd55dd +dd5ddddddddddedddd666666666666666666667666766676667666766676667666766676667666766676667666766666666686866666666ddddeddddddd5dddd +dd5dddddddddedddd66666666666666666667666766676667666766676667666766676667666766676667666766676666666666666666666ddddedddddd5dddd +dd5ddddddddedddd6666666666666666667666766676667666766676667666766676667666766676667666766676667666666666666666666ddddeddddd5dddd +ddd55dddddedddd66666c666666666667666766676667666766676667666766676667666766676667666766676667666766666666666666666ddddeddddd55dd +ddddddddddedddd666ccccc6666666766676667666766676667666766676667666766676667666766676667666766676667666666666666666ddddeddddddddd +dddddddddedddd66666ccc66666676667666766676667666766676667666766676667666766676667666766676667666766676666666d666666ddddedddddddd +ddddddddedddd666666c6c666666667666766676667666766676667666766676667666766676667666766676667666766676666666ddddd66666ddddeddddddd +dddddddedddd66666666666666667666766676667666766676667666766676667666766676667666766676667666766676667666666ddd6666666ddddedddddd +dddddddedddd66666666666666766676667666766676667666766676667666766676667666766676667666766676667666766676666d6d6666666ddddedddddd +ddddddedddd66666666666666666766676667666766676667666766676667666766676667666766676667666766676667666766666666666666666ddddeddddd +ddddddeddd6666666666666666766676667666766676667666766676667666766676667666766676667666766676667666766676666666666666666dddeddddd + +__map__ +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000270000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000002700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000002700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000002700000000000000002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0026000000000000000607000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000060700000000061616070000060700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0006161607000006161616160706161600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0616161616070616161616161616161600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1616161616161616161616161616161600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1616161616161616161616161616161600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1616161616161616161616161616161600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__sfx__ +000100000e0701007011070140601505017040190401b0301c0301e0301f020210202202024020250202702028020290102b0102c0102d0102e0102e0102f0103001030010310103101031010320100000000000 +01100000007450070500705007050c7450070500705007050474500705007050070510745007050070500705027450070500705007050e7450070500705007050774500705007050070513745007050070500705 +01100000180001c0001f03623026180161c0161f00023000180361c0261f01621016000000000000000000001a0361d02621016240161f006230061a0361d0361f026230261d0261f0261d0261f0162370526705 +31040000185501c5501f550185501c5501f5501c5501f550245501c5501f55024550285501f550245502855000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__music__ +01 01424344 +00 01424344 +00 01024344 +02 01024344 + diff --git a/demos/automata.p8 b/demos/automata.p8 new file mode 100644 index 0000000..2042945 --- /dev/null +++ b/demos/automata.p8 @@ -0,0 +1,222 @@ +pico-8 cartridge // http://www.pico-8.com +version 19 +__lua__ +-- 1-d cellular automata demo +-- by zep +-- ref: wikipedia.org/wiki/cellular_automaton + +cls() +l=0 -- line count + +--uncomment for kaleidoscope +--poke(0x5f2c,7) + +-- starting rule set +r={[0]=0,1,0,1,1,0,0,1} + + +function _update() + + l+=1 + -- change rule every 16 lines + -- (or when ❎ is pressed) + if (l%16==0 or btnp(❎)) then + for i=1,7 do + r[i]=flr(rnd(2.3)) + end + end + + + -- if the line is blank, add + -- something to get it started + + found = false + for x=0,127 do + if (pget(x,127)>0) found=true + end + + if (not found) then + pset(63,127,7) + end + +end + +function _draw() + -- scroll + memcpy(0x6000,0x6040,0x1fc0) + + for x=0,127 + do n=0 + for b=0,2 do + if (pget(x-1+b,126)>0) + then + n += 2 ^ b -- 1,2,4 + end + end + pset(x,127,r[n]*7) + end + +end + +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__label__ +00000000000000000000000000000000000000000000000000000007000000000000000700000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000070700000000000007070000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000700070000000000070007000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000007070707000000000707070700000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000070000000700000007000000070000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000707000007070000070700000707000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000007000700070007000700070007000700000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000070707070707070707070707070707070000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000707070707070707070707070707070700000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000007070707070707070707070707070707000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000070707070707070707070707070707070000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000707070707070707070707070707070700000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000007070707070707070707070707070707000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000070707070707070707070707070707070000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000707070707070707070707070707070700000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000007070707070707070707070707070707000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000070707070707070707070707070707070000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000707070707070707070707070707070700000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000007070707070707070707070707070707000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000070707070707070707070707070707070000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000707070707070707070707070707070700000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000007070707070707070707070707070707000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000070707070707070707070707070707070000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000707070707070707070707070707070700000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000007777777777777777777777777777777e0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000007777777777777777777777777777777e000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000007777777777777777777777777777777e00000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000007777777777777777777777777777777e0000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000007777777777777777777777777777777e000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000007777777777777777777777777777777e00000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000007777777777777777777777777777777e0000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000007777777777777777777777777777777e000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000007777777777777777777777777777777e00000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000007777777777777777777777777777777e0000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000007777777777777777777777777777777e000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000007777777777777777777777777777777e00000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000007777777777777777777777777777777e0000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000007777777777777777777777777777777e000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000007777777777777777777777777777777e00000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000007777777777777777777777777777777e0000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000007000000000000000000000000000000007000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000070700000000000000000000000000000070700000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000700070000000000000000000000000000700070000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000007070707000000000000000000000000007070707000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000070000000700000000000000000000000070000000700000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000707000007070000000000000000000000707000007070000000000000000000000000000000000000000000 +00000000000000000000000000000000000000007000700070007000000000000000000007000700070007000000000000000000000000000000000000000000 +00000000000000000000000000000000000000070707070707070700000000000000000070707070707070700000000000000000000000000000000000000000 +00000000000000000000000000000000000000700000000000000070000000000000000700000000000000070000000000000000000000000000000000000000 +00000000000000000000000000000000000007070000000000000707000000000000007070000000000000707000000000000000000000000000000000000000 +00000000000000000000000000000000000070007000000000007000700000000000070007000000000007000700000000000000000000000000000000000000 +00000000000000000000000000000000000707070700000000070707070000000000707070700000000070707070000000000000000000000000000000000000 +00000000000000000000000000000000007000000070000000700000007000000007000000070000000700000007000000000000000000000000000000000000 +00000000000000000000000000000000070700000707000007070000070700000070700000707000007070000070700000000000000000000000000000000000 +00000000000000000000000000000000700070007000700070007000700070000700070007000700070007000700070000000000000000000000000000000000 +00000000000000000000000000000007070707070707070707070707070707007070707070707070707070707070707000000000000000000000000000000000 +00000000000000000000000000000007e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7707e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7700000000000000000000000000000000 +000000000000000000000000000000070000000000000000000000000000007e7000000000000000000000000000000770000000000000000000000000000000 +00000000000000000000000000000007700000000000000000000000000000707700000000000000000000000000000777000000000000000000000000000000 +000000000000000000000000000000077700000000000000000000000000007e7770000000000000000000000000000707700000000000000000000000000000 +000000000000000000000000000000070770000000000000000000000000007000770000000000000000000000000007e7770000000000000000000000000000 +00000000000000000000000000000007e77700000000000000000000000000770077700000000000000000000000000700077000000000000000000000000000 +00000000000000000000000000000007000770000000000000000000000000777070770000000000000000000000000770077700000000000000000000000000 +00000000000000000000000000000007700777000000000000000000000000707e7e777000000000000000000000000777070770000000000000000000000000 +000000000000000000000000000000077707077000000000000000000000007e7000007700000000000000000000000707e7e777000000000000000000000000 +0000000000000000000000000000000707e7e77700000000000000000000007077000077700000000000000000000007e7000007700000000000000000000000 +00000000000000000000000000000007e700000770000000000000000000007e7770007077000000000000000000000707700007770000000000000000000000 +00000000000000000000000000000007077000077700000000000000000000700077007e777000000000000000000007e7770007077000000000000000000000 +00000000000000000000000000000007e77700070770000000000000000000770077707000770000000000000000000700077007e77700000000000000000000 +0000000000000000000000000000000700077007e7770000000000000000007770707e7700777000000000000000000770077707000770000000000000000000 +00000000000000000000000000000007700777070007700000000000000000707e7e7007707077000000000000000007770707e7700777000000000000000000 +00000000000000000000000000000007770707e770077700000000000000007e700077077e7e7770000000000000000707e7e700770707700000000000000000 +000000000000000000000000000000e0770000777ee077e00000000000000e077e0e07007777777e00000000000000e0007777ee0700007e0000000000000000 +00000000000000000000000000000e0007e00e077770077e000000000000e000770000ee07777777e000000000000e0e0e07777700e00e07e000000000000000 +0000000000000000000000000000e0e0e07ee000777ee077e0000000000e0e0e07e00e07007777777e0000000000e00000007777ee0ee0007e00000000000000 +000000000000000000000000000e000000077e0e077770077e00000000e00000007ee000ee07777777e00000000e0e00000e077777007e0e07e0000000000000 +00000000000000000000000000e0e00000e0770000777ee077e000000e0e00000e077e0e07007777777e000000e000e000e0007777ee0700007e000000000000 +0000000000000000000000000e000e000e0007e00e077770077e0000e000e000e000770000ee07777777e0000e0e0e0e0e0e0e07777700e00e07e00000000000 +000000000000000000000000e0e0e0e0e0e0e07ee000777ee077e00e0e0e0e0e0e0e07e00e07007777777e00e0000000000000007777ee0ee0007e0000000000 +00000000000000000000000e00000000000000077e0e077770077ee0000000000000007ee000ee07777777ee0e0000000000000e077777007e0e07e000000000 +0000000000000000000000e0e0000000000000e0770000777ee0777e0000000000000e077e0e07007777777700e00000000000e0007777ee0700007e00000000 +000000000000000000000e000e00000000000e0007e00e0777700777e00000000000e000770000ee07777777ee0e000000000e0e0e07777700e00e07e0000000 +00000000000000000000e0e0e0e000000000e0e0e07ee000777ee0777e000000000e0e0e07e00e07007777777700e0000000e00000007777ee0ee0007e000000 +0000000000000000000e0000000e0000000e000000077e0e0777700777e0000000e00000007ee000ee07777777ee0e00000e0e00000e077777007e0e07e00000 +000000000000000000e0e00000e0e00000e0e00000e0770000777ee0777e00000e0e00000e077e0e07007777777700e000e000e000e0007777ee0700007e0000 +00000000000000000e000e000e000e000e000e000e0007e00e0777700777e000e000e000e000770000ee07777777ee0e0e0e0e0e0e0e0e07777700e00e07e000 +0000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0e0e07ee000777ee0777e0e0e0e0e0e0e0e07e00e0700777777770000000000000000007777ee0ee0007e00 +000000000000000e000000000000000000000000000000077e0e077770077700000000000000007ee000ee07777777e0000000000000000e077777007e0e07e0 +0000000000000077e000000000000000000000000000007e07e7ee007e7e07e000000000000007e07e07e7ee0000007e0000000000000077ee0007e7e7e7ee7e +00000000000007e07e0000000000000000000000000007e7ee0007e7e007ee7e0000000000007e7ee7ee0007e00007e7e0000000000007e007e07e0000000007 +0000000000007e7ee7e00000000000000000000000007e0007e07e007e7e0007e00000000007e0000007e07e7e007e007e00000000007e7e7e7ee7e000000077 +000000000007e000007e000000000000000000000007e7e07e7ee7e7e007e07e7e000000007e7e00007e7ee007e7e7e7e7e000000007e0000000007e000007e7 +00000000007e7e0007e7e0000000000000000000007e007ee00000007e7e7ee007e0000007e007e007e0007e7e000000007e0000007e7e00000007e7e0007e07 +0000000007e007e07e007e00000000000000000007e7e7e07e000007e000007e7e7e00007e7e7e7e7e7e07e007e0000007e7e00007e007e000007e007e07e7e7 +000000007e7e7e7ee7e7e7e000000000000000007e00007ee7e0007e7e0007e00007e007e00000000007ee7e7e7e00007e007e007e7e7e7e0007e7e7e7ee0007 +00000007e00000000000007e0000000000000007e7e007e0007e07e007e07e7e007e7e7e7e000000007e00000007e007e7e7e7e7e0000007e07e00000007e077 +0000007e7e000000000007e7e00000000000007e007e7e7e07e7ee7e7e7ee007e7e0000007e0000007e7e000007e7e7e000000007e00007e7ee7e000007e7ee7 +000007e007e0000000007e007e000000000007e7e7e00007ee00000000007e7e007e00007e7e00007e007e0007e00007e0000007e7e007e000007e0007e00007 +00007e7e7e7e00000007e7e7e7e0000000007e00007e007e07e000000007e007e7e7e007e007e007e7e7e7e07e7e007e7e00007e007e7e7e0007e7e07e7e0077 +0007e0000007e000007e0000007e00000007e7e007e7e7e7ee7e0000007e7e7e00007e7e7e7e7e7e0000007ee007e7e007e007e7e7e00007e07e007ee007e7e7 +007e7e00007e7e0007e7e00007e7e000007e007e7e0000000007e00007e00007e007e00000000007e00007e07e7e007e7e7e7e00007e007e7ee7e7e07e7e0007 +07e007e007e007e07e007e007e007e0007e7e7e007e00000007e7e007e7e007e7e7e7e000000007e7e007e7ee007e7e0000007e007e7e7e00000007ee007e077 +7e7e7e7e7e7e7e7ee7e7e7e7e7e7e7e07e00007e7e7e000007e007e7e007e7e0000007e0000007e007e7e0007e7e007e00007e7e7e00007e000007e07e7e7ee7 +e000000000000000000000000000007ee7e007e00007e0007e7e7e007e7e007e00007e7e00007e7e7e007e07e007e7e7e007e00007e007e7e0007e7ee0000007 +0e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eeeee000000 +00e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eeeee00000 +000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eeeee0000 +0000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eeeee000 +00000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eeeee00 +000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eeeee0 +0000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eeeee +00000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eeee +000000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000eee +0000000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000ee +00000000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000e +000000000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee000 +0000000000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee00 +00000000000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee0 +000000000000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eeee +0000000000000000e00000000000000000000000000000eeeee00ee0000ee000eeeeee00eeee00ee0000eeee0000eeeeee00e70ee00eeeeee00ee0000ee00eee +0000000000000007e700000000000000000000000000070000e770e70070e70700000e77000e770e7007000e700700000e770e00e7700000e770e70070e7700e +00000000000000700e700000000000000000000000007e700700e00e77e00e0e7000700e70700e00e77e7070e77e7000700e0e7700e7000700e00e77e000e77e +00000000000007e770e700000000000000000000000700e77e77e77000e77e00e707e770e0e77e770000e0e00000e707e77e000e770e707e77e77000e707000e +0000000000007000e00e70000000000000000000007e7700000000e707000e770e0000e0e000000e7007e0e700070e00000e70700e00e0000000e7070e0e707e +000000000007e707e770e700000000000000000007000e700000070e0e70700e0e7007e0e7000070e770e00e707e0e700070e0e77e77e70000070e0e0e00e00e +0000000000700e0000e00e7000000000000000007e7070e700007e0e00e0e77e00e770e00e7007e000e0e770e00e00e707e0e00000000e70007e0e0e0e77e77e +0000000007e77e7007e770e7000000000000000700e0e00e70070e0e77e0000e7700e0e770e770e707e000e0e77e770e00e0e700000070e7070e0e0e0000000e +00000000700000e77000e00e700000000000007e77e0e770e77e0e0000e700700e77e000e000e00e00e707e000000e0e77e00e700007e00e0e0e0e0e7000007e + diff --git a/demos/bounce.p8 b/demos/bounce.p8 new file mode 100644 index 0000000..70d9452 --- /dev/null +++ b/demos/bounce.p8 @@ -0,0 +1,225 @@ +pico-8 cartridge // http://www.pico-8.com +version 19 +__lua__ +-- bouncy ball demo +-- by zep + +size = 10 +ballx = 64 +bally = size +floor_y = 100 + +-- starting velocity +velx = rnd(6)-3 +vely = rnd(6)-3 + +function _draw() + cls(1) + + print("press ❎ to bump", + 32,10, 6) + + fillp(░) + rectfill(0,floor_y,127,127,12) + fillp() -- reset + + circfill(ballx,bally,size,14) + + spr(1,ballx-4-velx, + bally-4-vely) +end + +function _update60() + + -- move ball left/right + + if ballx+velx < 0+size or + ballx+velx > 128-size + then + -- bounce on side! + velx *= -1 + sfx(1) + else + -- move by x velocity + ballx += velx + end + + -- move ball up/down + + if bally+vely < 0+size or + bally+vely > floor_y-size + then + -- bounce on floor/ceiling + vely = vely * -0.9 + sfx(0) + + -- if bounce was too small, + -- bump into air + if vely < 0 and + vely > -0.5 then + velx = rnd(6)-3 + vely = -rnd(5)-4 + sfx(3) + end + + else + bally += vely + end + + -- gravity! + vely += 0.2 + + -- press ❎ to ranomly + -- choose a new velocity + if (btnp(5)) then + velx = rnd(6)-3 + vely = rnd(6)-8 + sfx(2) + end + +end + +__gfx__ +00000000008887000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000088888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0070070008ffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000085ff5800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0007700008ffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700888888880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000088888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000008008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__label__ +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777666766676667766776677777766666777777666776677777666767676667666777777777777777777777777777777777 +77777777777777777777777777777777676767676777677767777777667676677777767767677777676767676667676777777777777777777777777777777777 +77777777777777777777777777777777666766776677666766677777666766677777767767677777667767676767666777777777777777777777777777777777 +77777777777777777777777777777777677767676777776777677777667676677777767767677777676767676767677777777777777777777777777777777777 +77777777777777777777777777777777677767676667667766777777766666777777767766777777666776676767677777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777eeeeeee77777777777777777777777777777777777777777777777777777777777777777777777777777 +777777777777777777777777777777777777777777eeeeeeeeeee777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777eeeeeeeeeeeee77777777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777777eeeeeeeeeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777777 +777777777777777777777777777777777777777eeeeeeeeeeeeeeeee777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777eeeeeeeddd7eeeeeeee77777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777eeeeeeddddddeeeeeee77777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777eeeeeeedffffdeeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777eeeeeeed5ff5deeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777eeeeeeedffffdeeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777eeeeeeddddddddeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777eeeeeeeddddddeeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777eeeeeeedeeeedeeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777eeeeeeeeeeeeeeeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777eeeeeeeeeeeeeeeeeee77777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777eeeeeeeeeeeeeeeeeee77777777777777777777777777777777777777777777777777777777777777777777777 +777777777777777777777777777777777777777eeeeeeeeeeeeeeeee777777777777777777777777777777777777777777777777777777777777777777777777 +7777777777777777777777777777777777777777eeeeeeeeeeeeeee7777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777eeeeeeeeeeeee77777777777777777777777777777777777777777777777777777777777777777777777777 +777777777777777777777777777777777777777777eeeeeeeeeee777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777eeeeeee77777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 +88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 + +__sfx__ +000300000f01112051180311e021280113a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000100001a76011750247300070000700007000070000700007000070000700007000070000700007000070000700007000070000700007000070000700007000070000700007000070000700007000070000700 +000400000c47011470164600f460164501b44013430164201b420184201d4202241027410164000c4000c4000f40013400114000c4000f4000f4000c400004000040000400004000040000400004000040000400 +000400000c5700c5501154018530165201f5101d50018500185001f500225001d5001f500225002b5002250029500245002450029500275002b5002b500005000050000500005000050000500005000050000500 diff --git a/demos/cast.p8 b/demos/cast.p8 new file mode 100644 index 0000000..4a94ef3 --- /dev/null +++ b/demos/cast.p8 @@ -0,0 +1,520 @@ +pico-8 cartridge // http://www.pico-8.com +version 41 +__lua__ +-- raycasting demo +-- by zep + +-- field of view +fov = 0.2 -- 0.2 = 72 degrees + +-- true: to get wall patterns +-- based on distance +if (false) then +patterns={ + [0]=♥,▤,∧,✽,♥,◆, + ░,░,░,░, + …,…,…,… +} +end + +function _init() + -- create player + pl={} + pl.x = 12 pl.y = 12 + pl.dx = 0 pl.dy = 0 + pl.z = 12 + pl.d = 0.25 + pl.dz = 0 + pl.jetpack=false + + -- map + for y=0,31 do + for x=0,31 do + mset(x,y,mget(x,y)*3) + end + end + +end + +-- map z +function mz(x,y) + return 16-mget(x,y)*0.125 +end + +function _update() + + -- moving walls + + for x=10,18 do + for y=26,28 do + mset(x,y,34+cos(t()/4+x/14)*19) + end + end + + -- control player + + local dx=0 + local dy=0 + + if (btn(❎)) then + -- strafe + if (btn(⬅️)) dx-=1 + if (btn(➡️)) dx+=1 + else + -- turn + if (btn(⬅️)) pl.d+=0.02 + if (btn(➡️)) pl.d-=0.02 + end + + -- forwards / backwards + if (btn(⬆️)) dy+= 1 + if (btn(⬇️)) dy-= 1 + + spd = sqrt(dx*dx+dy*dy) + if (spd) then + + spd = 0.1 / spd + dx *= spd + dy *= spd + + pl.dx += cos(pl.d-0.25) * dx + pl.dy += sin(pl.d-0.25) * dx + pl.dx += cos(pl.d+0.00) * dy + pl.dy += sin(pl.d+0.00) * dy + + end + + local q = pl.z - 0.6 + if (mz(pl.x+pl.dx,pl.y) > q) + then pl.x += pl.dx end + if (mz(pl.x,pl.y+pl.dy) > q) + then pl.y += pl.dy end + + -- friction + pl.dx *= 0.6 + pl.dy *= 0.6 + + -- z means player feet + if (pl.z >= mz(pl.x,pl.y) and pl.dz >=0) then + pl.z = mz(pl.x,pl.y) + pl.dz = 0 + else + pl.dz=pl.dz+0.01 + pl.z =pl.z + pl.dz + end + + -- jetpack / jump when standing + if (btn(4)) then + if (pl.jetpack or + mz(pl.x,pl.y) < pl.z+0.1) + then + pl.dz=-0.15 + end + end + +end + +function draw_3d() + local celz0 + local col + + -- calculate view plane + + local v={} + v.x0 = cos(pl.d+fov/2) + v.y0 = sin(pl.d+fov/2) + v.x1 = cos(pl.d-fov/2) + v.y1 = sin(pl.d-fov/2) + + + for sx=0,127 do + + -- make all of these local + -- for speed + local sy=127 + + -- camera based on player pos + local x=pl.x + local y=pl.y + -- (player eye 1.5 units high) + local z=pl.z-1.5 + + local ix=flr(x) + local iy=flr(y) + local tdist=0 + local col=mget(ix,iy) + local celz=16-col*0.125 + + -- calc cast vector + local dist_x, dist_y,vx,vy + local last_dir + local t=sx/127 + + vx = v.x0 * (1-t) + v.x1 * t + vy = v.y0 * (1-t) + v.y1 * t + local dir_x = sgn(vx) + local dir_y = sgn(vy) + local skip_x = 1/abs(vx) + local skip_y = 1/abs(vy) + + if (vx > 0) then + dist_x = 1-(x%1) else + dist_x = (x%1) + end + if (vy > 0) then + dist_y = 1-(y%1) else + dist_y = (y%1) + end + + dist_x = dist_x * skip_x + dist_y = dist_y * skip_y + + -- start skipping + local skip=true + + while (skip) do + + if (dist_x < dist_y) then + ix=ix+dir_x + last_dir = 0 + dist_y = dist_y - dist_x + tdist = tdist + dist_x + dist_x = skip_x + else + iy=iy+dir_y + last_dir = 1 + dist_x = dist_x - dist_y + tdist = tdist + dist_y + dist_y = skip_y + end + + -- prev cel properties + col0=col + celz0=celz + + -- new cel properties + col=mget(ix,iy) + + --celz=mz(ix,iy) + celz=16-col*0.125 -- inlined for speed + +-- print(ix.." "..iy.." "..col) + + if (col==72) then skip=false end + + --discard close hits + if (tdist > 0.05) then + -- screen space + + local sy1 = celz0-z + sy1 = (sy1 * 64)/tdist + sy1 = sy1 + 64 -- horizon + + -- draw ground to new point + + if (sy1 < sy) then + + line(sx,sy1-1,sx,sy, + sget((celz0*2)%16,8)) + + sy=sy1 + end + + -- draw wall if higher + + if (celz < celz0) then + local sy1 = celz-z + + + sy1 = (sy1 * 64)/tdist + sy1 = sy1 + 64 -- horizon + if (sy1 < sy) then + + local wcol = last_dir*-6+13 + if (not skip) then + wcol = last_dir+5 + end + if (patterns) then + fillp(patterns[flr(tdist/3)%8]-0.5) + wcol=103+last_dir*102 + end + + line(sx,sy1-1,sx,sy, + wcol) + sy=sy1 + + fillp() + end + end + end + end -- skipping + end -- sx + + cursor(0,0) color(7) + print("cpu:"..flr(stat(1)*100).."%",1,1) +end + + +function _draw() + cls() + + -- to do: sky? stars? + rectfill(0,0,127,127,12) + draw_3d() + -- draw map + if (false) then + map(0,0,0,0,32,32) + pset(pl.x*8,pl.y*8,12) + pset(pl.x*8+cos(pl.d)*2,pl.y*8+sin(pl.d)*2,13) + end +end + + + + +__gfx__ +00000000111111112222222233333333444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffff +00000000111111112222222233333333444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffff +00700700111111112222222233333333444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffff +00077000111111112222222233333333444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffff +00077000111111112222222233333333444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffff +00700700111111112222222233333333444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffff +00000000111111112222222233333333444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffff +00000000111111112222222233333333444444445555555566666666777777778888888899999999aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffff +32222228a9e89aeb00000000000000004444444400000000000000000000000088888888000000000000000000000000000000000000000000000000ffffffff +000000000000000000000000000000004444444400000000000000000000000088888888000000000000000000000000000000000000000000000000f888888f +0000000000000000000000000000000044ffff4400000000000000000000000088ffff88000000000000000000000000000000000000000000000000f8ffff8f +0000000000000000000000000000000044ffff4400000000000000000000000088ffff88000000000000000000000000000000000000000000000000f8ffff8f +0000000000000000000000000000000044ffff4400000000000000000000000088ffff88000000000000000000000000000000000000000000000000f8ffff8f +0000000000000000000000000000000044ffff4400000000000000000000000088ffff88000000000000000000000000000000000000000000000000f8ffff8f +000000000000000000000000000000004444444400000000000000000000000088888888000000000000000000000000000000000000000000000000f888888f +000000000000000000000000000000004444444400000000000000000000000088888888000000000000000000000000000000000000000000000000ffffffff +__label__ +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc6666 +cc77c777c7c7ccccc777c7c7c7c7ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc66666 +c7ccc7c7c7c7cc7cc7ccc7c7ccc7ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc6666666 +c7ccc777c7c7ccccc777c777cc7cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc666666666 +c7ccc7ccc7c7cc7cccc7ccc7c7cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc6666666666 +cc77c7cccc77ccccc777ccc7c7c7cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc666666666666 +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc6666666666666 +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc666666666666666 +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc66666666666666666 +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc666666666666666666 +555ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc66666666666666666666 +55555555cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc6666666666666666666666 +5555555555555cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc66666666666666666666666 +55555555555555555cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc6666666666666666666666666 +5555555555555555555555ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc666666666666666666666666666 +555555555555555555555555555ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc6666666666666666666666666666 +55555555555555555555555555555555cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc666666666666666666666666666666 +555555555555555555555555555555555555ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc6666666666666666666666666666666 +55555555555555555555555555555555555555555cccccccccccccccccccccccccccccccccccccccccccccccccccccc666666666666666666666666666666666 +5555555555555555555555555555555555555555555555ccccccccccccccccccccccccccccccccccccccccccccccc6666666667d666666666666666666666666 +555555555555555555555555555555555555555555555555555ccccccccccccccccccccccccccccccccccccccccc66666666777ddddd66666666666666666666 +5555555555555555555555555555555555555555555555555555555ccccccccccccccccccccccccccccccccccc6666666677777dddddddd66666666666666666 +555555555555555555555555555555555555555555555555555555555555cccccccccccccccccccccccccccc666666666777777ddddddddddd66666666666666 +55555555555555555555555555555555555555555555555555555555555555555cccccccccccccccccccccc6666666677777777dddddddddddddd66666666666 +5555555555555555555555555555555555555555555555555555555555555555555555ccccccccccccccc666666667777777777dddddddddddddddddd6666666 +55555555555555555555555555555555555555555555555555555555555555555555555555ccccccccc66666666777777777777ddddddddddddddddddddd6666 +5555555555555555555555555555555555555555555555555555555555555555555555555555555ccc666666667777777777777dddddddddddddddddddddddd6 +5555555555555555555555555555555555555555555555555555555555555555555555555555555556666666777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555555555555556666677777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555555555555556667777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555555555555556677777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555555555555557777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555555555555777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555555555577777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555555555777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555555577777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555557777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555555777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555557777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555555777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555557777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555557777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555555555555555555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555555dddddddddd55555555555577777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555777dddddddddddddddddddddd77777777777777777777777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555777dddddddddddddddddddddd77777777777777777777777777777777777777777777ddddddddddddddddddddddddd +555555555555555555555555555555555577777ddddddddddddddddddddddddd777777777777777777777777777777777777777ddddddddddddddddddddddddd +555555555555555555555555555555555577777ddddddddddddddddddddddddd777777777777777777777777777777777777777ddddddddddddddddddddddddd +555555555555555555555555555555555577777ddddddddddddddddddddddddd777777777777777777777777777777777777777ddddddddddddddddddddddddd +555555555555555555555555555555555577777777ddddddddddddddddddddddddddd7777777777777777777777777777777777ddddddddddddddddddddddddd +555555555555555555555555555555555577777777ddddddddddddddddddddddddddd7777777777777777777777777777777777ddddddddddddddddddddddddd +555555555555555555555555555555555577777777ddddddddddddddddddddddddddd7777777777777777777777777777777777ddddddddddddddddddddddddd +55555555555555555555555555555555557777777777aaaaaaaaaaaaaaaaaaaaddddddddddddd77777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555777777777777ddddddddddddddddddddddddddddddd77777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555777777777777ddddddddddddddddddddddddddddddd77777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555777777777777ddddddddddddddddddddddddddddddd77777777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555777777777777ddddddddddddddddddeeeeeeeeeeeeeeeee7777777777777777777777ddddddddddddddddddddddddd +5555555555555555555555555555555555777777777777eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeedddd7777777777777777ddddddddddddddddddddddddd +5555555555555555555333333333333333377777777777777eeeeeeeeeeeeeddddddddddddddddddddddddd7777777777777777ddddddddddddddddddddddddd +333333333333333333333333333333333333377777777777777dddddddddddddddddddddddddddddddddddd7777777777777777ddddddddddddddddddddddddd +333333333333333333333333333333333333337777777777777dddddddddddddddddddddddddddddddddddd7777777777777777ddddddddddddddddddddddddd +333333333333333333333333333333333333333777777777777dddddddddddddddddddddddddddddddddddd7777777777777777ddddddddddddddddddddddddd +333333333333333333333333333333333333333337777777777ddddddddddddddddddddddddddbbbbbbbbbbbbbb777777777777ddddddddddddddddddddddddd +333333333333333333333333333333333333333333777777777dddddddddddddbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb777777ddddddddddddddddddddddddd +333333333333333333333333333333333333333333337777777bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb7ddddddddddddddddddddddddd +33333333333333333333333333333333333333333333377777777bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbddddddddddddddddddddddddddddddddd +3333333333333333333333333333333333333333333333777777777bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbddddddddddddddddddddddddddddddddddddddddddd +333333333333333333333333333333333333333333333333777777777bbbbbbbbbbbbbbbbbbbdddddddddddddddddddddddddddddddddddddddddddddd333333 +33333333333333333333333333333333333333333333333337777777777bbbbbbbddddddddddddddddddddddddddddddddddddddddddddddddd3333333333333 +333333333333333333333333333333333333333333333333337777777777dddddddddddddddddddddddddddddddddddddddddddddddd33333333333333333333 +333333333333333333333333333333333333333333333333333377777777ddddddddddddddddddddddddddddddddddddddddd333333333333333333333333333 +333333333333333333333333333333333333333333333333333337777777dddddddddddddddddddddddddddddddddd3333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333377777dddddddddddddddddddddddddd333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333337777ddddddddddddddddddd3333333333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333333777dddddddddddd33333333333333333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333333337ddddd333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + +__map__ +1818181818181818181818181818181818181818181818181818181818181818000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1806060708090a0b000000000000000001000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1806060708090a0b000100000000000101010000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1806060c0c0c0c0c000000000404000001000005000000000c030303030c0018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1806060c0c0c0c0c000000000404000000000505050000000303030303030018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1806060504030201000000000000000000000005000000000303030303030018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1806060504030201000000000000000000000000000000000303030303030018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000000000000000000000000000000000000000000000303030303030018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000000000000000000000000000000000000000000000c030303030c0018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000000000000000000000000000000000000000000000102030302010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000001000001000000000000000000000000000000000102030302010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000000000000000000000000010000000000000000000102030302010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000001000001000000000001000100000000000000000102030302010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000000000000000000000000010000000000000000000102030302010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800140d0d01010d0d1400000000000000000000000000000102030302010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0d0d02020d0d0d00000000000000000000000001000102040402010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0d0d03030d0d0d00000000000000000000000000000102050502010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0d0d04040d0d0d00000000000000000000000000000102060602010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0d0d05050d0d0d00000000000000000000000000000102070702010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0606060606060d00000000000000000000000000000102080802010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0606060606060d00000000000000000000000000000102090902010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0606060606060d000000000000000000000000000001020a0a02010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0606060606060d000000000000000000000000000001020b0b02010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18001406060606060614000000000000000000000000000001020c0c02010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d07070d0d0d0d0d0000000000000000000d0d0d0d0d0d0d0d0d02010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d08080d0d0d0d0d0000000000000000000d0d0d0d0d0d0d0d0d02010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d09090a0b0c0d0d0000000000000000000d0d0d0d0d0d0d0d0d02010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d09090a0b0c0d0d0000000000000000000d0d0d0d0d0d0d0d0d02010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +18000d0d0d0d0d0d0d0d0000000000000000000d0d0d0d0d0d0d0d0d02010018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1818181818181818181818181818181818181818181818181818181818181818000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__music__ +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 + diff --git a/demos/collide.p8 b/demos/collide.p8 new file mode 100644 index 0000000..0ee17ea --- /dev/null +++ b/demos/collide.p8 @@ -0,0 +1,484 @@ +pico-8 cartridge // http://www.pico-8.com +version 30 +__lua__ +-- wall and actor collisions +-- by zep + +actor = {} -- all actors + +-- make an actor +-- and add to global collection +-- x,y means center of the actor +-- in map tiles +function make_actor(k, x, y) + a={ + k = k, + x = x, + y = y, + dx = 0, + dy = 0, + frame = 0, + t = 0, + friction = 0.15, + bounce = 0.3, + frames = 2, + + -- half-width and half-height + -- slightly less than 0.5 so + -- that will fit through 1-wide + -- holes. + w = 0.4, + h = 0.4 + } + + add(actor,a) + + return a +end + +function _init() + + -- create some actors + + -- make player + pl = make_actor(21,2,2) + pl.frames=4 + + -- bouncy ball + local ball = make_actor(33,8.5,11) + ball.dx=0.05 + ball.dy=-0.1 + ball.friction=0.02 + ball.bounce=1 + + -- red ball: bounce forever + -- (because no friction and + -- max bounce) + local ball = make_actor(49,7,8) + ball.dx=-0.1 + ball.dy=0.15 + ball.friction=0 + ball.bounce=1 + + -- treasure + + for i=0,16 do + a = make_actor(35,8+cos(i/16)*3, + 10+sin(i/16)*3) + a.w=0.25 a.h=0.25 + end + + -- blue peopleoids + + a = make_actor(5,7,5) + a.frames=4 + a.dx=1/8 + a.friction=0.1 + + for i=1,6 do + a = make_actor(5,20+i,24) + a.frames=4 + a.dx=1/8 + a.friction=0.1 + end + +end + +-- for any given point on the +-- map, true if there is wall +-- there. + +function solid(x, y) + -- grab the cel value + val=mget(x, y) + + -- check if flag 1 is set (the + -- orange toggle button in the + -- sprite editor) + return fget(val, 1) + +end + +-- solid_area +-- check if a rectangle overlaps +-- with any walls + +--(this version only works for +--actors less than one tile big) + +function solid_area(x,y,w,h) + return + solid(x-w,y-h) or + solid(x+w,y-h) or + solid(x-w,y+h) or + solid(x+w,y+h) +end + + +-- true if [a] will hit another +-- actor after moving dx,dy + +-- also handle bounce response +-- (cheat version: both actors +-- end up with the velocity of +-- the fastest moving actor) + +function solid_actor(a, dx, dy) + for a2 in all(actor) do + if a2 != a then + + local x=(a.x+dx) - a2.x + local y=(a.y+dy) - a2.y + + if ((abs(x) < (a.w+a2.w)) and + (abs(y) < (a.h+a2.h))) + then + + -- moving together? + -- this allows actors to + -- overlap initially + -- without sticking together + + -- process each axis separately + + -- along x + + if (dx != 0 and abs(x) < + abs(a.x-a2.x)) + then + + v=abs(a.dx)>abs(a2.dx) and + a.dx or a2.dx + a.dx,a2.dx = v,v + + local ca= + collide_event(a,a2) or + collide_event(a2,a) + return not ca + end + + -- along y + + if (dy != 0 and abs(y) < + abs(a.y-a2.y)) then + v=abs(a.dy)>abs(a2.dy) and + a.dy or a2.dy + a.dy,a2.dy = v,v + + local ca= + collide_event(a,a2) or + collide_event(a2,a) + return not ca + end + + end + end + end + + return false +end + + +-- checks both walls and actors +function solid_a(a, dx, dy) + if solid_area(a.x+dx,a.y+dy, + a.w,a.h) then + return true end + return solid_actor(a, dx, dy) +end + +-- return true when something +-- was collected / destroyed, +-- indicating that the two +-- actors shouldn't bounce off +-- each other + +function collide_event(a1,a2) + + -- player collects treasure + if (a1==pl and a2.k==35) then + del(actor,a2) + sfx(3) + return true + end + + sfx(2) -- generic bump sound + + return false +end + +function move_actor(a) + + -- only move actor along x + -- if the resulting position + -- will not overlap with a wall + + if not solid_a(a, a.dx, 0) then + a.x += a.dx + else + a.dx *= -a.bounce + end + + -- ditto for y + + if not solid_a(a, 0, a.dy) then + a.y += a.dy + else + a.dy *= -a.bounce + end + + -- apply friction + -- (comment for no inertia) + + a.dx *= (1-a.friction) + a.dy *= (1-a.friction) + + -- advance one frame every + -- time actor moves 1/4 of + -- a tile + + a.frame += abs(a.dx) * 4 + a.frame += abs(a.dy) * 4 + a.frame %= a.frames + + a.t += 1 + +end + +function control_player(pl) + + accel = 0.05 + if (btn(0)) pl.dx -= accel + if (btn(1)) pl.dx += accel + if (btn(2)) pl.dy -= accel + if (btn(3)) pl.dy += accel + +end + +function _update() + control_player(pl) + foreach(actor, move_actor) +end + +function draw_actor(a) + local sx = (a.x * 8) - 4 + local sy = (a.y * 8) - 4 + spr(a.k + a.frame, sx, sy) +end + +function _draw() + cls() + + room_x=flr(pl.x/16) + room_y=flr(pl.y/16) + camera(room_x*128,room_y*128) + + map() + foreach(actor,draw_actor) + +end + +__gfx__ +000000003bbbbbb7dccccc770cccccc00000000000ccc70000ccc70000ccc70000ccc70000000000000000000000000000000000000000000000000000000000 +000000003000000bd0000077d000007c101110100cccccc00cccccc00cccccc00cccccc000000000000000000000000000000000000000000000000000000000 +000000003000070bd000000cd000770c000000000cffffc00cffffc00cffffc00cffffc000000000000000000000000000000000000000000000000000000000 +000000003000000bd000000cd000770c000000000c5ff5c00c5ff5c00c5ff5c00c5ff5c000000000000000000000000000000000000000000000000000000000 +000000003000000bd000000cd000000c000000000cffffc00cffffcc0cffffc0ccffffc000000000000000000000000000000000000000000000000000000000 +000000003000000bd000000cd000000c00101101ccccccccccccccc0cccccccc0ccccccc00000000000000000000000000000000000000000000000000000000 +000000003000000bd000000cd000000c000000000cccccc00cccccc00cccccc00cccccc000000000000000000000000000000000000000000000000000000000 +00000000111111115111111101111110000000000c0000c0c00000c00c0000c00c00000c00000000000000000000000000000000000000000000000000000000 +aaaaaaaa00ffff0000ffff0000000000000000000770077077000770077007700770007700000000000000000000000000000000000000000000000000000000 +a000000a00dffd0000dffd0000000000000000000e7007e0e77007e00e7007e00e70077e00000000000000000000000000000000000000000000000000000000 +a000000a00ffff0000ffff0000000000000000000e7007e00e7007e00e7007e00e7007e000000000000000000000000000000000000000000000000000000000 +a000000a0882288ff882288000000000000000000777777007777770077777700777777000000000000000000000000000000000000000000000000000000000 +a000000af08228000082280f00000000000000000717717007177170071771700717717000000000000000000000000000000000000000000000000000000000 +a000000a008558000085580000000000000000000077770000777700007777000077770000000000000000000000000000000000000000000000000000000000 +a000000a005005000500005000000000000000000077770000777770007777000777770000000000000000000000000000000000000000000000000000000000 +aaaaaaaa066006606600006600000000000000000700070000700000007000700000070000000000000000000000000000000000000000000000000000000000 +0000000000aaaa000077770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000a0000a00700007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000a000770a70007707000aa000000aa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000a000770a7000770700aa7a0000aaaa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000a000000a7000000700aaaa0000a7aa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000a000000a70000007000aa000000aa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000a0000a00700007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000aaaa000077770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000008888000088880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000088888800888888000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000888887788888877800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000888887788888877800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000008e8888888e88888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000008eee88888eee888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000008ee888008ee888000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000008888000088880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__label__ +dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc7700000000 +d0000077d0000077d0000077d0000077d0000077d0000077d0000077d0000077d0000077d0000077d0000077d0000077d0000077d0000077d000007700000000 +d000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000c00000000 +d000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000c00000000 +d000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000c00000000 +d000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000c00000000 +d000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000c00000000 +51111111511111115111111151111111511111115111111151111111511111115111111151111111511111115111111151111111511111115111111100000000 +dccccc7700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dccccc7700000000 +d000007700000000000000000000000000000000000000000000000000000000000000001011101000000000000000000000000000000000d000007700000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000010110100000000000000000000000000000000d000000c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000 +51111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005111111100000000 +dccccc770000000000000000000000000000000000000000000000000cccccc0000000000000000000000000000000000000000000000000dccccc7700000000 +d0000077000000000000000000000000000000000000000000000000d000007c000000000000000000000000000000000000000010111010d000007700000000 +d000000c000000000000000000000000000000000000000000000000d000770c000000000000000000000000000000000000000000000000d000000c00000000 +d000000c000000000000000000000000000000000000000000000000d000770c000000000000000000000000000000000000000000000000d000000c00000000 +d000000c000000000000000000000000000000000000000000000000d000000c000000000000000000000000000000000000000000000000d000000c00000000 +d000000c000000000000000000000000000000000000000000000000d000000c000000000000000000000000000000000000000000101101d000000c00000000 +d000000c000000000000000000000000000000000000000000000000d000000c000000000000000000000000000000000000000000000000d000000c00000000 +51111111000000000000000000000000000000000000000000000000011111100000000000000000000000000ffff00000000000000000005111111100000000 +0cccccc0dccccc77dccccc77dccccc77000000000000000000000000000000000000000000000000000000000dffd00000000000000000000cccccc000000000 +d000007cd0000077d0000077d0000077000000000000000000000000101110100000000000000000000000000ffff0000000000000000000d000007c00000000 +d000770cd000000cd000000cd000000c00000000000000000000000000000000000000000000000000000000882288f00000000000000000d000770c00000000 +d000770cd000000cd000000cd000000c0000000000000000000000000000000000000000000000000000000f082280000000000000000000d000770c00000000 +d000000cd000000cd000000cd000000c00000000000000000000000000000000000000000000000000000000085580000000000000000000d000000c00000000 +d000000cd000000cd000000cd000000c00000000000000000000000000101101000000000000000000000000050050000000000000000000d000000c00000000 +d000000cd000000cd000000cd000000c00000000000000000000000000000000000000000000000000000000660066000000000000000000d000000c00000000 +01111110511111115111111151111111000000000000000000000000000000000000000000000000000000000000000000000000000000000111111000000000 +dccccc7700000000000000000000000000000000000000000000000000000000000000003bbbbbb700000000000000000000000000000000dccccc7700000000 +d000007700000000101110100000000000000000000000000000000000000000000000003000000b00000000000000000000000000000000d000007700000000 +d000000c00000000000000000000000000000000000000000000000000000000000000003000070b00000000000000000000000000000000d000000c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000003000000b00000000000000000000000000000000d000000c00000000 +d000000c000000000000000000000000000000000000000000000000000000000ccc70003000000b00000000000000000000000000000000d000000c00000000 +d000000c00000000001011010000000000000000000000000000000000000000cccccc003000000b00000000000000000000000000000000d000000c00000000 +d000000c00000000000000000000000000000000000000000000000000000000cffffc003000000b00000000000000000000000000000000d000000c00000000 +5111111100000000000000000000000000000000000000000000000000000000c5ff5c0011111111000000000000000000000000000000005111111100000000 +dccccc7700000000dccccc770000000000000000008888000000000000000000cffffc000000000000000000000000000cccccc000000000dccccc7700000000 +d000007700000000d0000077000000000000000018888880000000000000000cccccccc0000000000000000000000000d000007c00000000d000007700000000 +d000000c00000000d000000c0000000000000000288888880000000000000000cccccc00000000000000000000000000d000770c00000000d000000c00000000 +d000000c00000000d000000c00000000000000002e8e8e8e0000000000000000c0000c00000000000000000000000000d000770c00000000d000000c00000000 +d000000c00000000d000000c00000000000000002e8e8e8e000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c00000000d000000c000000000000000022888888000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c00000000d000000c000000000000000002288880000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +51111111000000005111111100000000000000000022220000000000000000000000000000000000000000000000000001111110000000005111111100000000 +dccccc770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dccccc7700000000dccccc7700000000 +d00000770000000000000000000000000000000000000000101110100000000000000000000000000000000000000000d000007700000000d000007700000000 +d000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c0000000000000000000000000000000000000000001011010000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c0000000000000000000000000000000000000000000000000000000000aaaa00000000000000000000000000d000000c00000000d000000c00000000 +51111111000000000000000000000000000000000000000000000000000000000a0000a000000000000000000000000051111111000000005111111100000000 +dccccc7700000000000000000000000000000000000000000000000000000000a000770a000000003bbbbbb700000000dccccc77000000000cccccc000000000 +d000007700000000000000000000000000000000000000000000000000000000a000770a101110103000000b00000000d000007700000000d000007c00000000 +d000000c00000000000000000000000000000000000000000000000000000000a000000a000000003000070b00000000d000000c00000000d000770c00000000 +d000000c00000000000000000000000000000000000000000000000000000000a000000a000000003000000b00000000d000000c00000000d000770c00000000 +d000000c000000000000000000000000000000000000000000000000000000000a0000a0000000003000000b00000000d000000c00000000d000000c00000000 +d000000c0000000000000000000000000000000000000000000000000000000000aaaa00001011013000000b00000000d000000c00000000d000000c00000000 +d000000c0000000000000000000000000000000000000000000000000000000000000000000000003000000b00000000d000000c00000000d000000c00000000 +51111111000000000000000000000000000000000000000000000000000000000000000000000000111111110000000051111111000000000111111000000000 +0cccccc00000000000000000dccccc77dccccc77dccccc770000000000000000000000003bbbbbb73bbbbbb7000000000000000000000000dccccc7700000000 +d000007c1011101000000000d0000077d0000077d00000770000000000000000000000003000000b3000000b000000000000000000000000d000007700000000 +d000770c0000000000000000d000000cd000000cd000000c0000000000000000000000003000070b3000070b000000000000000000000000d000000c00000000 +d000770c0000000000000000d000000cd000000cd000000c0000000000000000000000003000000b3000000b000000000000000000000000d000000c00000000 +d000000c0000000000000000d000000cd000000cd000000c0000000000000000000000003000000b3000000b000000000000000000000000d000000c00000000 +d000000c0010110100000000d000000cd000000cd000000c0000000000000000000000003000000b3000000b000000000000000000000000d000000c00000000 +d000000c0000000000000000d000000cd000000cd000000c0000000000000000000000003000000b3000000b000000000000000000000000d000000c00000000 +01111110000000000000000051111111511111115111111100000000000000000000000011111111111111110000000000000000000000005111111100000000 +dccccc770000000000000000dccccc77dccccc77dccccc77000000000000000000000000000000000000000000000000dccccc7700000000dccccc7700000000 +d00000770000000000000000d0000077d0000077d0000077000000000000000000000000101110100000000000000000d000007700000000d000007700000000 +d000000c0000000000000000d000000cd000000cd000000c000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c0000000000000000d000000cd000000cd000000c000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c0000000000000000d000000cd000000cd000000c000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +d000000c0000000000000000d000000cd000000cd000000c000000000000000000000000001011010000000000000000d000000c00000000d000000c00000000 +d000000c0000000000000000d000000cd000000cd000000c000000000000000000000000000000000000000000000000d000000c00000000d000000c00000000 +51111111000000000000000051111111511111115111111100000000000000000000000000000000000000000000000051111111000000005111111100000000 +dccccc77000000000000000000000000000000000000000000000000dccccc77dccccc77dccccc77dccccc77dccccc77dccccc7700000000dccccc7700000000 +d0000077000000000000000000000000000000000000000000000000d0000077d0000077d0000077d0000077d0000077d000007710111010d000007700000000 +d000000c000000000000000000000000000000000000000000000000d000000cd000000cd000000cd000000cd000000cd000000c00000000d000000c00000000 +d000000c000000000000000000000000000000000000000000000000d000000cd000000cd000000cd000000cd000000cd000000c00000000d000000c00000000 +d000000c000000000000000000000000000000000000000000000000d000000cd000000cd000000cd000000cd000000cd000000c00000000d000000c00000000 +d000000c000000000000000000000000000000000000000000000000d000000cd000000cd000000cd000000cd000000cd000000c00101101d000000c00000000 +d000000c000000000000000000000000000000000000000000000000d000000cd000000cd000000cd000000cd000000cd000000c00000000d000000c00000000 +51111111000000000000000000000000000000000000000000000000511111115111111151111111511111115111111151111111000000005111111100000000 +dccccc77000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cccccc000000000 +d000007700000000000000001011101000000000000000000000000000000000000000000000000000000000000000000000000000000000d000007c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000770c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000770c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000 +d000000c00000000000000000010110100000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000 +d000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000c00000000 +51111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111000000000 +0cccccc0dccccc77dccccc77dccccc77dccccc770cccccc0dccccc77dccccc77dccccc77dccccc77dccccc77dccccc77dccccc770cccccc0dccccc7700000000 +d000007cd0000077d0000077d0000077d0000077d000007cd0000077d0000077d0000077d0000077d0000077d0000077d0000077d000007cd000007700000000 +d000770cd000000cd000000cd000000cd000000cd000770cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000770cd000000c00000000 +d000770cd000000cd000000cd000000cd000000cd000770cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000770cd000000c00000000 +d000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000c00000000 +d000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000c00000000 +d000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000cd000000c00000000 +01111110511111115111111151111111511111110111111051111111511111115111111151111111511111115111111151111111011111105111111100000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +70700000770077000000707077707770700000000000000000000000000000007070000077700000707070707770777000000000000000000000000000000000 +70700000070007000000707070007070700000000000000000000000000000007070000000700000707070707070707000000000000000000000000000000000 +07000000070007000000777077707070777000000000000000000000000000007770000007700000777077707770777000000000000000000000000000000000 +70700000070007000000007000707070707000000000000000000000000000000070000000700000007000700070707000000000000000000000000000000000 +70700000777077700700007077707770777000000000000000000000000000007770000077700700007000700070777000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + +__gff__ +0002020200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__map__ +0202020202020202020202020202020202020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000000000000000400000000000202000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000202000003000000000004000202000000000000000004040000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0300000202000004000000000000000202000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000000000000000000000000000202000000040000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000000040000000000000000000202000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000000000400000000000000000202000000000002020202000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000000000000000400000000000000000000000002020202000000040002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0304000000000000000000000000000000000000000002020202000400000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000000000000000400000000000202000000000002020202000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000000000000000000000000000202000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000400000000000000000000000202000404040000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0300020200000000000000000202000202000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200020200000000040000000202000202000000000004040000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0200000000000000000000000000000202000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020302020202030202020202020202020200000000020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002020202020200000000020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000404000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000040400000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000004000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000004040000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000040000000000000004000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000040000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000002020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__sfx__ +000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000100000c55012540075100050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500 +000100003073020750217201171000700007000070000700007000070000700007000070000700007000070000700007000070000700007000070000700007000070000700007000070000700007000070000700 +000400002a3602e350313300030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300 diff --git a/demos/dots3d.p8 b/demos/dots3d.p8 new file mode 100644 index 0000000..725bfaf --- /dev/null +++ b/demos/dots3d.p8 @@ -0,0 +1,311 @@ +pico-8 cartridge // http://www.pico-8.com +version 19 +__lua__ +-- 3d dot party +-- by zep + +function _init() + -- make some points + pt={} + for y=-1,1,1/3 do + for x=-1,1,1/3 do + for z=-1,1,1/3 do + p={} + p.x=x p.y=y p.z=z + p.col=8 + (x*2+y*3)%8 + add(pt,p) + end + end + end + +end + +-- rotate point x,y by a +-- (rotates around 0,0) +function rot(x,y,a) + local x0=x + x = cos(a)*x - sin(a)*y + y = cos(a)*y + sin(a)*x0 -- *x is wrong but kinda nice too + return x,y +end + +function _draw() + cls() + + for p in all(pt) do + --transform: + --world space -> camera space + + p.cx,p.cz=rot(p.x,p.z,t()/8) + p.cy,p.cz=rot(p.y,p.cz,t()/7) + + p.cz += 2 + cos(t()/6) + end + + -- sort furthest -> closest + -- (so that things in distance + -- aren't drawn over things + -- in the foreground) + + for pass=1,4 do + for i=1,#pt-1 do + if pt[i].cz < pt[i+1].cz then + --swap + pt[i],pt[i+1]=pt[i+1],pt[i] + end + end + for i=#pt-1,1,-1 do + if pt[i].cz < pt[i+1].cz then + --swap + pt[i],pt[i+1]=pt[i+1],pt[i] + end + end + end + + rad1 = 5+cos(t()/4)*4 + for p in all(pt) do + --transform: + --camera space -> screen space + sx = 64 + p.cx*64/p.cz + sy = 64 + p.cy*64/p.cz + rad= rad1/p.cz + -- draw + + if (p.cz > .1) then + circfill(sx,sy,rad,p.col) + circfill(sx+rad/3,sy-rad/3,rad/3,7) + end + end + +--print(stat(1),2,2,7) +end + +__gfx__ +70000000777077707770077077707070070077700000777070707000777077707770000077707070777077707770777007000000077007707770077077707770 +07000000777070007770700070707070700070700000707070707000707070707070000070707070007070707070707000700000700070000700707070707000 +00700000707077007070700077707770700070700000707007007770707070707070000070700700777070707070707000700000700077700700707077007700 +07000000707070007070700070000070700070700700707070707070707070707070070070707070700070707070707000700000700000700700707070707000 +70000000707077707070077070007770070077707000777070707770777077707770700077707070777077707770777007000000077077000700770070707770 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000070007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000700000700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000700000700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000700000700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000070007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000eee00000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000eee7e0000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000eee777e000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000eeee7ee000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000eeefffe000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000efff7f000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000eee0000fff777f00000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000eee7e000ffff7ff00000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000eeeee000fffffff00000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000eeeee0000ff887000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000fff00000088777e0000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000ddd0000fff7f00008888788e000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000ddd7d00fff777f0008888888e000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000ddddd00ffff7ff0008888888f000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000ddddd00fffffffee0088999f7f00000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000ddd0000f888fee7e099999797f0000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000ccc000eee000088878eeee09999777ff0000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000ccc7c0eee7e008887778eee999999799f0000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000ccccc0eeeee0d8888788ee09999999997e000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000ccccc0eeeeedd8888888ff09999999998e000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000ccc00dddc00fffe0ddd88888ff7f09999999778000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000ccc7cddd7d0fff7f0dddd999fffffe9999aaa788000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000cccccdddddfff777f0dd99979ffffe7eaaaaaaa8f00000000000000000000000000000000000000000000 +000000000000000000000000000000000000000bbb0cccccdddddffff7ff0e9997779888eeeaaaaa7aff00000000000000000000000000000000000000000000 +00000000000000000000000000000000000000bbbbbdddc00ddd0fffffffee99997998878eaaaaa777afe0000000000000000000000000000000000000000000 +00000000000000000000000000000000000000bb7bdd7dd0eeec00fffff0ee999999987778aaaaaa7aa9e0000000000000000000000000000000000000000000 +00000000000000000000000000000000000000bbbbdddddeee7ec0088800eee99999888788aaaaaaaaa790000000000000000000000000000000000000000000 +0000000000000000000000000000000000bbb00bbbddddeee777e088878cceee9998888888faaaaaaa7990000000000000000000000000000000000000000000 +000000000000000000000000000000000bbb7ccc000dddeeee7ee8887778cfffaaad88888ffaaaaaaa999f000000000000000000000000000000000000000000 +000000000000000000000000000000000bbbccc7c00bbbeeeeeee8888788ffaaaaa7a8999ffeeaaa99998ff00000000000000000000000000000000000000000 +000000000000000000000000000000000bbbccccceeebb7eeeee08888888ffaaaa77799979eee00099988ff00000000000000000000000000000000000000000 +00000000000000000000000000000000bbbbcccceee7ebfffeedcc88888cfaaaaaa7aa977798ffebbbbbaff00000000000000000000000000000000000000000 +0000000000000000000000000000000bbb7b0ccceeeeefff7fddcce8880ddaaaaaaaaa99799787bbbbbbbaa00000000000000000000000000000000000000000 +0000000000000000000000000000000bbbbdddbbeeeefff777fdcee7eedd7aaaaaaaaa9999988bbbbb7bbbaf0000000000000000000000000000000000000000 +0000000000000000000000000000000bbbddd7dbbeeeffff7ffb0e999edd88aaaaaaa9999988bbbbb777bbbaf000000000000000000000000000000000000000 +00000000000000000000000000000000bbdddddfffccfffffffb099979d888aaaaaaae999888bbbbbb7bbbbaf000000000000000000000000000000000000000 +000000000000000000000000000000ccc0ddddfff7fccfffffeb999777988887aaaffeeeed99bbbbbbbbbbbaf000000000000000000000000000000000000000 +00000000000000000000000000000ccccc0ddfff777fccfffee099997998888888fffeaaa999bbbbbbbbbbbfff00000000000000000000000000000000000000 +00000000000000000000000000000cc7cc000ffff7ff0beeeeec9999999e88888bbbcaaaa797bbbbbbbbbbb88ff0000000000000000000000000000000000000 +00000000000000000000000000000cccceee0fffffff8887eeccf99999eee88bbbb7bbaa77797bbbbbbbbb9998f0000000000000000000000000000000000000 +000000000000000000000000000000cceee7e0fffff888777cccff999eeeeedbbb777baaa7a999bbbbbbbaaa79f0000000000000000000000000000000000000 +00000000000000000000000000000000eeeeeccfff8888878ccefffffdee99bbbbb7bbbaaaa9990bbbbbbbb777f0000000000000000000000000000000000000 +000000000000000000000000000ddd00eeeee8880d8888888f0eefffddd999bbbbbbbbbaaa99999987bbbbbbba8f000000000000000000000000000000000000 +00000000000000000000000000ddddd00eee8887808888888f0eaaae0d9999bbbbbbbbbaaffaaa9798bbbbb7ba88000000000000000000000000000000000000 +00000000000000000000000000ddd7d00008887778e88888ffaaaaa7af99999bbbbbbb0fffaaa7a99bccccc77b98000000000000000000000000000000000000 +00000000000000000000000000ddddd000088887887e888ffdaaaa777f99999bbbbbbb88faaa777a9cccc777bba9000000000000000000000000000000000000 +000000000000000000000000000dddfff008888888eeccdddaaaaaa7aaf99999ebbb888bbbaaa7aacccc77777b7a800000000000000000000000000000000000 +00000000000000000000000000000fff7fdd88888e999c0ddaaaaaaaaaff999ffe997bbbbb7baaaccccc77777c77a80000000000000000000000000000000000 +0000000000000000000000000000fff777fd78889999999ecaaaaaaaaaeeeffff9977bbbb777aacccccc77777ccaa80000000000000000000000000000000000 +0000000000000000000000000000ffff7ffddd0099999798ecaaaaaaa0beefff9999bbbbbb7bbaccccccc777cccbb90000000000000000000000000000000000 +000000000000000000000000eee0fffffffddd09999977798caaaaaaaf88aaafcccccbbbbbbbbacccccccccccccbb90000000000000000000000000000000000 +00000000000000000000000eee7e0fffff9990f9999997998c00aaaff88aaa7cccccccbbbbbbbaccccccccccccc7bb0000000000000000000000000000000000 +00000000000000000000000eeeee00fff99979f99999999980eee00ff8aaa7cccccc7ccbbbbbbbcccccccccccccbbb9000000000000000000000000000000000 +00000000000000000000000eeeee00009997779f999999980ee9990ff8aaacccccc777ccbbbbbb7cccccccccccccbb9900000000000000000000000000000000 +000000000000000000000000eee000009999799f9999999d0ebbbbb0ffaaaccccccc7cccbbbbb777cccccccccccccb9900000000000000000000000000000000 +0000000000000000000000000008870e9999999ffd999ff7dbbbbbbbee0aaccccccccccc99bbbb7bbcccccccccc7ccb900000000000000000000000000000000 +0000000000000000000000000088777ee99999000009997fbbbbbbbbb88faccccccccccc90bbbbbbbacccccccc777ccb00000000000000000000000000000000 +00000000000000000000fff008888788ee99900eee99979bbbbbbb7bbb88fcccccccccccf99bbbbbbbbaccccccc7cccb00000000000000000000000000000000 +0000000000000000000fff7f08888888eee000ee7999777bbbbbb777bb9900cccccccccfccc9bbbbbb7bcccccccccccba0000000000000000000000000000000 +000000000000000000fff777f88888880000888eaaa9979bbbbbbb7bbb97988cccccccccccc7c9bbb777ccccccccccc7ba000000000000000000000000000000 +000000000000000000ffff7ff0888880000888aaaa7aa99bbbbbbbbbbb777988cccccacccc7779bbbb7bccccccccccc77b000000000000000000000000000000 +000000000000000000fffffff0088800008887aaa777a99bbbbbbbbbbb97bbb800aaacccccc7ccbbbbbbbccccccccc7cbb000000000000000000000000000000 +0000000000000000000fffff00000faaa0888aaaaa7aaaeebbbbbbbbb9bbbb7bb8888ccccccccc9bbbbbb7ccccccc777bb000000000000000000000000000000 +00000000000000000000fff00000aaaaa7a88aaaaaaaaaee9bbbbbbb99bbb777b9780ccccccccccccbbbbbbccccccc7ccb000000000000000000000000000000 +0000000000000000000000000000aaaa77788aaaaaaaaa8aaabbbbb99bbbbb7bbb8888cccccccccc7ccbbbbbccccccccc7b00000000000000000000000000000 +000000000000000000000009990aaaaaa7aa88aaaaaaa88aaaaa7a999bbbbbbbbb8999ccccccccc777cbbbbbcccccccccbb00000000000000000000000000000 +000000000000000000000099979aaaaaaaaaffaaaaaaa8aaaaa777a99bbbbbbbbbbbb790cccccccc7ccc0bbb7ccccccc7cbb0000000000000000000000000000 +000000000000000088800999777aaaaaaaaaffffaaa788aaaaaa7aa999bbbbbbbbbbb799988ccccccccccbbbbccccccc77cb0000000000000000000000000000 +0000000000000008887809999799aaaaaaa0fffaaa7777aaaaaaaaa99abbbbbbbbbb7779990ccccccccc7cbbbb7ccccc7ccb0000000000000000000000000000 +0000000000000088877789999999aaaaaaa70faaaaa7affaaaaaaa87aaa7bbb9bbbbb7b9bbb9ccccccc777cbbbbbcccccccc0000000000000000000000000000 +000000000000008888788099999880aaa97770aaaaaaaffaaaaaaa8aaa777a99bbbbbbbbbb7bcccccccc7cccbbbb0ccccc77c000000000000000000000000000 +00000000000000888888800999887809999799aaaaaaaf0aaaaa088aaaa7aaaaabbbbbbbb777bbccccccccc7cbb000cccc7cc000000000000000000000000000 +000000000000000888880000888777899999990aaaaa90aaaa7aaf8aaaaaaaaa77bbb7bbbb7bbb7baccccc777c0000cccccccc00000000000000000000000000 +0000000000000000888000008888788999999909aaa779aaaaaaaffaaaaaaaaaa7a999bbbbbbb777b0ccccc7ccc0000ccccc77c0000000000000000000000000 +0000000000000000000000008888888099999889999799aaaaaaafaaaaaaaaaaaaaaaa0bbbbbbb7bbb0ccccccc7c0000cccc7cc0000000000000000000000000 +00000000000000000000000008888800099988899999990aaaaa0faaaaa0aaaaaaaaa7aabbbbbbbbb7b0ccccccccc000ccccccc0000000000000000000000000 +000000000000000000000000008880000088888099999009aaa909aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbccccccc7c000cccccc0000000000000000000000000 +0000000000000000000000000000000000088800899980099999999aaa9aaaaaaaaaaaaaa7aabbbbbbb7bb00cccccc0000ccccc0000000000000000000000000 +00000000000000000000000000000000000000008888808899909999999aaaaaaa7aaaaaaaaa7a0bbbbbbb000ccccc00000ccc00000000000000000000000000 +000000000000000000000000000000000000000008880088888899999999aaaaaaaaa7aaaaaaaa000bbbbb0000ccc00000000000000000000000000000000000 +0000000000000000000000000000000000000000000000888888899989999997aaaaaaaa0aaaaa0000bbb0000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000088808888888999999990aaaaa00aaa000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000008888888809999900aaa000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000888000999000000000000000000000000000000000000000000000000000000000000000 +__label__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000008880000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000088878000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000088888000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000088888000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000008fff000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000fff7f00000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000fff777f0000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000ffff7ff0000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000009990000fffffff0000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000999790000fffff00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000009999900000eee008880000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000999990000eeee788878000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000009990000eeee7778888000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000008880000eeeee7e8888000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000088878000eeeeeee8880000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000aaa000888880000eeeee00fff000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000aaa7a008888800999eee00fff7f00000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000aaaaa0008880099979ddd0fffff88800000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000aaaaa000fff00999dddd7ddffff88880000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000aaa000fff7f0999ddd777dfff887880000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000aaa00999000fff777f09ddddd7dddeee88880000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000aaa7a9997900ffff7ff08dddddddddee7e8800000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000aaaaa9999900fffffff88ddddddddde777e000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000aaaaa9999900afffff0888dddddddeee7eeff0000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000aaa00999000aafff00888dddddddeeeeeef7f800000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000bbb09990000000000aaa00008880ddd99eeeeeffff780000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000bbb7999990888aaa00eee000000009ccc90eeefffff880000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000bbbb99979888787aaeee7e00aaffccccccc0000fff8880000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000bbbb9999988888aaeee777eaafffccccc7c9ddd7088800000000000000000000000000000000000000000000 +0000000000000000000000000000000000000ccc0bbb0999088888aaeeee7eeaaffccccc777cdd777eefff880000000000000000000000000000000000000000 +000000000000000000000000000000000000ccccaaa0000bbb888aaaeeeeeeeaaffcccccc7ccddd7de7ef7f88000000000000000000000000000000000000000 +000000000000000000000000000000000000cc7aaa7a00bbbbb099900eeeee00aafcccccccccdddddeeefff88000000000000000000000000000000000000000 +000000000000000000000000000000000000cccaaaaa888bbfff999900eee0009990cccccccddddddeeefff88000000000000000000000000000000000000000 +0000000000000000000000000000000000000ccaaaa88878fff7f979008880099999cccccccdddddeeefff880000000000000000000000000000000000000000 +00000000000000000000000000000000007bbb00aaa8888fff777f9908ddd80997eeeacccf88ddd9700000fff000000000000000000000000000000000000000 +000000000000000000000000000000000cbbbbb00008888ffff7ff90ddddddd99eee7efff7f8878990dddeef7f00000000000000000000000000000000000000 +0000000000000000000000000000000000bbb799900c888fffffff70dddd7dd0eee777effff888890ddd7d7eff80000000000000000000000000000000000000 +0000000000000000000000000000000000bbb9997900c0aafffff8bdddd777ddeeee7eeffff888cccdd777deff00000000000000000000000000000000000000 +0000000000000000000000000000000bbb0bb999990000aaafff878ddddd7dddeeeeeebbbbb00ccc7cdd7ddef000000000000000000000000000000000000000 +000000000000000000000000000000bbb7b0099999fff00aaa88888ddddddddd8eeeebbbbbbbccc777cdddd00fff700000000000000000000000000000000000 +000000000000000000000000000000bbbaaa00999fff7f00cc888880ddddddd888eebbbbbb7bbccc7ccddd00eee7f00000000000000000000000000000000000 +000000000000000000000000000000bbaaaaa0000fffff990c088870ddddddd8888bbbbbb777bbcccccdd90eee7ef00000000000000000000000000000000000 +0000000000000000000000000000000baaa7a0000fffff97ee70aaa0ffddd009888bbbbbbb7bbbcccc0097dddeeef00000000000000000000000000000000000 +00000000000000000000000000000000aaaa888700fff99ee7770ac7fffff00790dbbbbbbbbbbbccc0087ddd7dee000000000000000000000000000000000000 +00000000000000000000000000000aaa0aa88878b00099eeee7ee0c08fff80bbbddbbbbbbbbbbb0afff8cccdddeeee0000000000000000000000000000000000 +0000000000000000000000000000aaa7a0088888aaa009eeeeeeef908888800bdddbbbbbbbbbbbafff7ccc7cddeeeee000000000000000000000000000000000 +0000000000000000000000000000aaaaa0088888aa7ab0eeeeeeef990ccc000fddddbbbbbbbbbeeeffccc777c0eee7e000000000000000000000000000000000 +0000000000000000000000000000aaa99900888aee7ab70eeeeeff9ccccccc8fdddddbbbbbbbeee7efcccc7cc0dddee000000000000000000000000000000000 +00000000000000000000000000000a999790aaaee7778880eeeff99cccc7cc8ffdddddbbbbb7eeeebbbccccccddd7d0000000000000000000000000000000000 +00000000000000000000000000000099999aaaeeee7ee878ab0099cccc777cc8ffdddb998dddeebbbbb7bccc0ddddde700000000000000000000000000000000 +00000000000000000000000000999099999aaaeeeeeee8887a7000ccccc7ccc888a08fffddd7debbbb777cc00cccddee00000000000000000000000000000000 +00000000000000000000000009999909990aaaeeeeeee888ab0000ccccccccc0caa8fffddd777bbbbbb7bb00ccc7cddd00000000000000000000000000000000 +000000000000000000000000099979000fffaa9eeeee88ddd00888bccccccc000ca0fffdddd7dbbbbbbbbb0ccc777cd7d0000000000000000000000000000000 +00000000000000000000000009999900fff7f099eeeaddddddde878ccccccc7feee0fffddddddbbbbbbbbbfcccc7ccddd0000000000000000000000000000000 +00000000000000000000000000999000fffff099999adddd7dd7e8800ccc0bfeee7cccffdddddfbbbbbbbeecccccccdddd000000000000000000000000000000 +00000000000000000000000000008880fffff909990dddd777dde880088800feeeccc7c0bbbbbdbbbbbbbe7bbbcccccdddd00000000000000000000000000000 +000000000000000000000000000888780fff9900000ddddd7ddde800887880feeccc777bbbb777ddbbb0eebbb7bccc7cd7d00000000000000000000000000000 +0000000000000000000000000008888809999ddd00fddddddddd0a00eee88bafecccc7bbbb77777ddd00ebbb777bccccddd00000000000000000000000000000 +000000000000000000000000888888880099dddd70ffddddddd09a7eddde8a7a0ccccbbbbb77777bdf0ddbbbb7bbccccdd000000000000000000000000000000 +00000000000000000000000887888880000dddd777ffdddddddff70ddd7d0b8700ccbbbbbb77777bbfdddbbbbbbbcccccc000000000000000000000000000000 +00000000000000000000000888880000000ddddd7d9fffdddfff7fddd777d88eee7cbbbbbbb777bbb0ddddbbbbbbbbccc7c00000000000000000000000000000 +0000000000000000000000088888000eee8ddddddd000009dddfffdbbbbbdaee7ee8bbbbbbbbbbbbbfdddddbbbbbb7bcccc00000000000000000000000000000 +000000000000000000000000888000eee7e8ddddd000888ddd7dffbbbbbbbaeeddd7bbbbbbbbbbbbb0bbbbbd7bbb777bccccc000000000000000000000000000 +00000000000000000000000000000eee777e0ddd000888ddd777dbbbbbbbbbeddd7dbbbbbbbbbbbbbbbbbbbbdbbbb7bbccc7cc00000000000000000000000000 +00000000000000000000000000000eeee7ee0000888888dddd7dbbbbbbb7bbbdd777dbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccc00000000000000000000000000 +0000000000000000000000000fff0eeeeeee00088eee88ddddddbbbbbb777bbddd7ddebbbbbbbbbbbbbbbb7bbbbbbbbbb7bccc00000000000000000000000000 +000000000000000000000000fff7f0eeeee00008eee7e88dddddbbbbbbb7bbbddddddedbbbbbbbcbbbbbb777bbdbbbbbbbbcc000000000000000000000000000 +00000000000000000000fff0fffff00eee0fff08eeeccc07ddd8bbbbbbbbbbbddddbbbddbbbbb0cbbbbbbb7bbbddd0bbbbbbb000000000000000000000000000 +0000000000000000000fff7ffffff00000fffff0eccccc7c8eeebbbbbbbbbbbddbbbbbbbddee070bbbbbbbbbbbbbb00bbbbb7b00000000000000000000000000 +0000000000000000000fffff0fff00fff0fff7f00cccc777eee7ebbbbbbbbbdddbbbbb7bdde0dddbbbbbbbbbbbbbbbb00bbbbb00000000000000000000000000 +0000000000000000000fffff00000fffffcccff0cccccc7cceeee8bbbbbbb8ddbbbbb777b00dd7ddbbbbbbbbbbbb7bb00bbbbbb0000000000000000000000000 +00000000000000000000fff000000fffccccc7cfccccccccceeee00bbbbb00ddbbbbbb7bb00ddddddbbbbbbbbbb777bb00bbbb7b000000000000000000000000 +00000000000000000000000000000fffcccc777fccccccccceeef0cccc7e0eedbbbbbbbbbdddbbbdddbbbbbbbbbb7bbbbb0bbbbb000000000000000000000000 +000000000000000000000000000dddfcccccc7cc7ccccccccfff7cccc777eee7ebbbbbbbdddbbb7bdddddd0bbbbbbbbbb7bbbbbb000000000000000000000000 +00000000000000000000000000ddd7dcccccccccfccccccc7cfffccccc7ceeeecbbbbbbbddbbb777bdbbb7d0bbbbbbbb777bbbb0000000000000000000000000 +000000000000000000000eee0ddd777cccccccccdd0cccc777cffccccccceeeccccbbbddddbbbb7bbbbb7bd0bbbbbbbbb7bbb000000000000000000000000000 +00000000000000000000eee7edddd7ddcccccccdd7d0cccc7ccff0cccccf0ecccc777e0cccbbbbbbbbb777bbb0bbbbbbbbbb7b00000000000000000000000000 +0000000000000000000eee777dddddddcccccccd777dcccccccff0ccccc0ffccccc7ceccc7cbbbbbbbbb7bbb7b0000bbbbb777b0000000000000000000000000 +0000000000000000eeeeeee7eeddddd0eecccdddd7dd0cccccdf0ccc777c0fcccccccccc777cbbb0bbbbbbb777b0000bbbbb7bbb000000000000000000000000 +000000000000000eee7eeeeeee0ddd0eee7e0ddddddd00cccd7d0cccc7ccffcccccc0cccc7cc0ccc0bbbbbbb7bbbb000bbbbbbb7bb0000000000000000000000 +000000000000000eeeeeeeeee0eee7eeeeeeeeddddd7e00ddddd0ccccccc0fccccc0ccccccccccc7ccbbbbbbbbbb7bbb0bbbbbbbb7b000000000000000000000 +000000000000000eeeee0eee00eeeeeeeeeeeeedddeeee0ddddd00ccccc00dccccccccccccccccccccc7cbbbbbbbbbbbb0bbbbbbbbb000000000000000000000 +0000000000000000eee0000000eeeee0eeeeee7eeeeeeee0ddd7e0dcccd0dddcccdcccccccc7ccccccccccbbbbbbbbb7b0000bbbbbb000000000000000000000 +000000000000000000000000000eee00000eeeee0eeee7e0eeeeeeddddd0dddddddcccccccccccccccccccccc0bbbbbbb000000bbb0000000000000000000000 +000000000000000000000000000000000000eee000eeeee0eeeeeeedddeeddddddddcccdccccccccccccccccc0000bbb00000000000000000000000000000000 +0000000000000000000000000000000000000000000eee000eeeeeeeeeeeeddd0ddddddddcccccccc0000ccc0000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000eee00eee0eeeee00ddd0ddddd00ccc000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000eee00000000ddd000000000000000000000000000000000000000000000000000000 +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 + diff --git a/demos/drippy.p8 b/demos/drippy.p8 new file mode 100644 index 0000000..feaa54c --- /dev/null +++ b/demos/drippy.p8 @@ -0,0 +1,435 @@ +pico-8 cartridge // http://www.pico-8.com +version 19 +__lua__ +-- drippy +-- by zep + +rectfill(0,0,127,127,1) +x=64 y=64 c=8 + +function _draw() + pset(x,y,c) +end + +function _update() + + if (btn(0)) then x=x-1 end + if (btn(1)) then x=x+1 end + if (btn(2)) then y=y-1 end + if (btn(3)) then y=y+1 end + + c=c+1/8 + if (c >= 16) then c = 8 end + + -- increase this number for + -- extra drippyness + for i=1,800 do + + -- choose a random pixel + local x2 = rnd(128) + local y2 = rnd(128) + local col = pget(x2,y2) + + --drip down if it is colourful + if (col > 1) then + pset(x2,y2+1,col) + end + end + +end + + + + + + +__gfx__ +00ffff0000ffff004444444433b333b3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008888 +001ff100001ff100444444443333333300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cc08998 +00ffff0000ffff00424444442222222200000000000007700000000000000000000000000000000000000000000000000000000000000000000000000cc08998 +f999999ff999999f4444444444444444000000000007777770000000000000000000000000000000000000000000000000000000000000000000000000008888 +00999900009999004444444444444444000700000077777770000000000000000000000000000000000000000000000000000000000000000000000088880000 +00aaaa000aaaaaa04444424444444444007a70000f777777f7770000000000000000000000000000000000000000000000000000000000000000000089980cc0 +00a00a0080000008444444444444444400070000fffff77777777000000000000000000000000000000000000000000000000000000000000000000089980cc0 +00800800000000004444444444444444000b0000ffffffff77777700000000000000000000000000000000000000000000000000000000000000000088880000 +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 +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 +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 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00ffff0000ffff006666666633b333b3004444000044440055555555667666760000000000000000000000000000000000000000000000000000000000000000 +001ff100001ff1006666666633333333001441000014410055555555666666660000000000000000000000000000000000000000000000000000000000000000 +00ffff0000ffff006566666655555555004444000044440051555555111111110000000000000000000000000000000000000000000000000000000000000000 +f888888ff888888f6666666666666666499999944999999455555555555555550000000000000000000000000000000000000000000000000000000000000000 +00888800008888006666666666666666009999000099990555555555555555550000000000000000000000000000000000000000000000000000000000000000 +00eeee000eeeeee0666665666666666600aaaa000aaaaaa055555155555555550000000000000000000000000000000000000000000000000000000000000000 +00e00e0040000004666666666666666600a00a008000000855555555555555550000000000000000000000000000000000000000000000000000000000000000 +00400400000000006666666666666666008008000000000055555555555555550000000000000000000000000000000000000000000000000000000000000000 +__label__ +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111b11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111111111111191111111111111111111111111bbbbbbbaa1111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111119111111111111111111111111bbbbbbbbaaa111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111911111111111111111111111cbbbbbbbbaaaa11111111111111111111111111111111111111111111111111111111111111111111 +1111111111111111111111181111111111111111111111ccbbbbbbbbaaaaa1111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111118111111111111111111111cccbbbbbbbbaaaaaa111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111811111111111111111111ccccbbbbbbbbaaaaaaa11111111111111111111111111111111111111111111111111111111111111111 +1111111111111111111111181111111111111111111cccccbbbb1bbbaaaaaaaa1111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111118111111111111111111ccccccbbbb1bbbaaaaaaaa9111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111811111111111111111cccccccbbbb1bbbaaaa1aaa9911111111111111111111111111111111111111111111111111111111111111 +1111111111111111111111181111111111111111ccccccccbbbb1bbbaaaa1aaa9991111111111111111111111111111111111111111111111111111111111111 +111111111111111111111118111111111111111dccccccccbbbb11bbaaaa1aaa9999111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111811111111111111ddcccccc1c111b11bb1aaa1a1a9999911111111111111111111111111111111111111111111111111111111111 +111111111111111eeeeefff81111111111111dddcccccc11111b11bb1aaa1a1a9999991111111111111111111111111111111111111111111111111111111111 +11111111111111eeeee1ffff1111111111111dddcccccc11111b11bb1aaa1a1a9999999111111111111111111111111111111111111111111111111111111111 +1111111111111ee11111fff11111111111111dddcccccc11111b11bb1aaa1a1a9999999911111111111111111111111111111111111111111111111111111111 +1111111111111ee11111fff11111111111111ddd1ccccc11111b11b11aaa111a9999999981111111111111111111111111111111111111111111111111111111 +1111111111111ee111111f111111111111111ddddcc11c11111b11b1111a111a9199999981111111111111111111111111111111111111111111111111111111 +1111111111111d11111111111111111111111ddddc111c11111111b1111111119199999981111111111111111111111111111111111111111111111111111111 +1111111111111d11111111111111111111111ddddce11c11111111b1111111111199999981111111111111111111111111111111111111111111111111111111 +1111111111111d11111111111111111111111ddddcee111111111111111111111199999981111111111111111111111111111111111111111111111111111111 +1111111111111dddddccccc11111111111111ddddcee111111111111111111111199199981111111111111111111111111111111111111111111111111111111 +1111111111111dddddcccccc1111111111111ddddcee111111111111111111111199899981111111111111111111111111111111111111111111111111111111 +111111111111111d1dcccccc1111111111111d1ddcee111111111111111111111198899881111111111111111111111111111111111111111111111111111111 +111111111111111111cccccc1111111111111d1ddcee111111111111eeefffffff98889881111111111111111111111111111111111111111111111111111111 +111111111111111111c11c1c1111111111111d1ddcee11111111111eeeefffffff98889881111111111111111111111111111111111111111111111111111111 +11111111111111111111111c1111111111111dedddee1111111111eeeeefffffff98888881111111111111111111111111111111111111111111111111111111 +11111111111111111111111c1111111111111feddeee111111111eeeeeeffffffff8888881111111111111111111111111111111111111111111111111111111 +11111111111111111abbbbbb1111111111111fedd1ee11111111eeeeeeeffffffff8888811111111111111111111111111111111111111111111111111111111 +1111111111111111aabbbbbb1111111111111feed1ee1111111eeeeeeeeffffffff8888811111111111111111111111111111111111111111111111111111111 +111111111111111aaa1bbbbb1111111111111feed11e1111111eee1eeeeffffffff8888811111111111111111111111111111111111111111111111111111111 +11111111111111aaa111bbb11111111111111feef11e1111111eee1eeeeff1fffff8818811111111111111111111111111111111111111111111111111111111 +1111111111111aaaa111b1b11111111111111feef11e1111111eeedeeeeff11ff1f8818811111111111111111111111111111111111111111111111111111111 +111111111111aaaaa11111111111111111111ffef1111111111eeedeeeeff11ff1f8818111111111111111111111111111111111111111111111111111111111 +111111111111aaa11111111111111111111111fef1111111111eeedeee11f11ff1f1818111111111111111111111111111111111111111111111111111111111 +111111111111aaa11111111111111111111111fef1111111111eeedede11f11f11f1811111111111111111111111111111111111111111111111111111111111 +111111111111aaa11111111111111111111111ff81111111111eeeddded1f11f11f1811111111111111111111111111111111111111111111111111111111111 +111111111111aa111111111111111111111111ff88111111111eeddddeddf11f11f1811111111111111111111111111111111111111111111111111111111111 +11111111111119999998111111111111111111ff88111111111eeddddeddc11f1111811111111111111111111111111111111111111111111111111111111111 +11111111111119999998811111111111111111ff88111111111eeddddeddcccfc111811111111111111111111111111111111111111111111111111111111111 +11111111111119991998881111111111111111ff88111111111eeddddeddccccc111811111111111111111111111111111111111111111111111111111111111 +111111111111119119988881111111111111111f88111111111eeddddeddccccc111111111111111111111111111111111111111111111111111111111111111 +111111111111119119918888111111111111111f88111111111eedddddddccccc111111111111111111111111111111111111111111111111111111111111111 +1111111111111111199188888111111111111118881111111111edddddddccccc111111111111111111111111111111111111111111111111111111111111111 +1111111111111111199188888811111111111118881111111111edddddddccccc111111111111111111111111111111111111111111111111111111111111111 +11111111111111111911818888111111111111188811111111111dddddddc1ccc111111111111111111111111111111111111111111111111111111111111111 +11111111111111111911811888111111111111188811111111111dd1ddddc1ccc111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111811888111111111111188811111111111dd1ddddc1ccc111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111188111111111111198811111111111d11ddddc11cc111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111ff81111111111111999111111111111111dddc11cc111111111111111111111111111111111111111111111111111111111111111 +1111111111111111111111ffff1111111111111999111111111111111dd1c11cc111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111fffff1111111111111999111111111111111dd1c11cc111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111ffffff1111111111111999111111111111111dd1c11cc111111111111111111111111111111111111111111111111111111111111111 +1111111111111111111ffffff11111111111111999111111111111111dd1c11ca111111111111111111111111111111111111111111111111111111111111111 +111111111111111111efff1f111111111111111999a111111111111111d11111a111111111111111111111111111111111111111111111111111111111111111 +11111111111111111eefff1f11111111111111191aa111111111111111d11111a111111111111111111111111111111111111111111111111111111111111111 +1111111111111111eee1ff1f1111111111111119aaa111111111111111d11111a111111111111111111111111111111111111111111111111111111111111111 +111111111111111eeee1111f111111111111111aaaa111111111111111d11111a111111111111111111111111111111111111111111111111111111111111111 +11111111111111eeeee1111111111111111111aaaaa1111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111eee1ee111111111111111111baaaaa1111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111eeee1ee11111111111111111bbaaaaa1111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111eeee11e1111111111111111bbbaa1aa1111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111eee1111111111111111111bbbbaa1aa1111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111eeed11111111111111111bbbbba111a1111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111eedd111111111111111bbbbb1a111a1111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111edddd1111111111111bbbbbb1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111e11ddd11111111111bbbbbb11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111e11ddddddccccccccbbb1bb11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111e11ddddddccccccccbbb1bb11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111111ddddddccccccccbbb11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111111ddd1ddccccccccbb111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111dd1ddccccccccbb111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111d1111ccc1ccccbb111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +1111111111111111111111ccc111ccbb111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111cbb111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111cb1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111cb1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +111111111111111111111111111111b1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + +__sfx__ +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__music__ +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 +00 41414141 + diff --git a/demos/hello.p8 b/demos/hello.p8 new file mode 100644 index 0000000..0bd0f33 --- /dev/null +++ b/demos/hello.p8 @@ -0,0 +1,221 @@ +pico-8 cartridge // http://www.pico-8.com +version 19 +__lua__ +-- hello world +-- by zep + +music(0) + +function _draw() + cls() + + -- for each color + -- (from pink -> white) + + for col = 14,7,-1 do + + -- for each letter + for i=1,11 do + + -- t() is the same as time() + t1 = t()*30 + i*4 - col*2 + + -- position + x = 8+i*8 +cos(t1/90)*3 + y = 38+(col-7)+cos(t1/50)*5 + pal(7,col) + spr(16+i, x, y) + end + end + + print("this is pico-8", + 37, 70, 14) + print("nice to meet you", + 34, 80, 12) + spr(1, 64-4, 90) -- ♥ +end + + + + + + + + + + + + + + + +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000088088000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000888887800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000888888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000088888000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000008880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000077007700777777007700000077000000777777000000000770007700777777007777770077000000777700000000000000000000000000000000000 +00000000077007700770000007700000077000000770077000000000770007700770077007700770077000000770077000000000000000000000000000000000 +00000000077007700770000007700000077000000770077000000000770707700770077007700770077000000770077000000000000000000000000000000000 +00000000077777700777700007700000077000000770077000000000777777700770077007777000077000000770077000000000000000000000000000000000 +00000000077007700770000007700000077000000770077000000000777077700770077007700770077000000770077000000000000000000000000000000000 +00000000077007700777777007777770077777700777777000000000770007700777777007700770077777700777777000000000000000000000000000000000 +__label__ +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 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000007777770077000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000007777770087788770077000000077770000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000007700770087708770077000000977907700000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000077000770087788770087777800a77000000977a97700000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000077000770087708770087789770a77000000977b97700000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000077070770087798770a877a8770a7777770c977097700000000000000000000000 +0000000000000088c088c00000000000000000000000000000000000000000077777770087777770a88998800a8888880c977777700000000000000000000000 +0000000000000077ce77ce0000000000000000000000000000000000000000977787770088aa8800a99ba990ca9999990c999999000000000000000000000000 +0000000000000077ce77ceaaaaaae000000000000000007777770000000000977888770088888800a99ab990caaaaaa00caaaaaa000000000000000000000000 +00000000000000778877ce7777770077000000770000007700770000000000988808880b99bb9900aaccaa00cbb00000ecbbbbbb000000000000000000000000 +00000000000000777777ce77e0000077000000770000007788770000000000988999880b99999900aabbaa00cbbbbbb0ecccccc0000000000000000000000000 +0000000000000077ce77ce77aae00077000000770000007799770000000000999099900baa0baa0dbbddbb00cc000000edd0edd0000000000000000000000000 +0000000000000077ee77ee77770000770000007700000077aa77000000000b990ab9900baaaaaa0dbbccbb00cccccc00edddddd0000000000000000000000000 +000000000000000000000077aaaae07700000077000000777777000000000baaaaaaa00bb00bb00dcc0dcc00dd000000ee00ee00000000000000000000000000 +000000000000000000000077777700777777007777770088cc88000000000baaa0aaa0dbbbbbb00dccdecc00dddddd00eeeeee00000000000000000000000000 +0000000000000000000000000000008888880088888800888888000000000baabbbaa0dcc0dcc00dd00dd000ee00000000000000000000000000000000000000 +0000000000000000000000000000009999990099999900999999000000000bbbcbbb00dccedcc00dd00dd000eeeeee0000000000000000000000000000000000 +00000000000000000000000000000000000000aaaaaa00aaaaaa000000000bbcccbb00dcccccc00eeee000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000bbbbbb00bbbbbb000000000cccdccc00dd00dd000ee00ee0000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000cccccc000000000ccdedcc00dddddd000ee00ee0000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000dddddd000000000dde0edd00ee00ee0000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000ee000ee00eeeeee0000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000eee0e0e0eee00ee00000eee00ee00000eee0eee00ee00ee00000eee000000000000000000000000000000000000 +00000000000000000000000000000000000000e00e0e00e00e00000000e00e0000000e0e00e00e000e0e00000e0e000000000000000000000000000000000000 +00000000000000000000000000000000000000e00eee00e00eee000000e00eee00000eee00e00e000e0e0eee0eee000000000000000000000000000000000000 +00000000000000000000000000000000000000e00e0e00e0000e000000e0000e00000e0000e00e000e0e00000e0e000000000000000000000000000000000000 +00000000000000000000000000000000000000e00e0e0eee0ee000000eee0ee000000e000eee00ee0ee000000eee000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000cc00ccc00cc0ccc00000ccc00cc00000ccc0ccc0ccc0ccc00000c0c00cc0c0c0000000000000000000000000000000 +0000000000000000000000000000000000c0c00c00c000c00000000c00c0c00000ccc0c000c0000c000000c0c0c0c0c0c0000000000000000000000000000000 +0000000000000000000000000000000000c0c00c00c000cc0000000c00c0c00000c0c0cc00cc000c000000ccc0c0c0c0c0000000000000000000000000000000 +0000000000000000000000000000000000c0c00c00c000c00000000c00c0c00000c0c0c000c0000c00000000c0c0c0c0c0000000000000000000000000000000 +0000000000000000000000000000000000c0c0ccc00cc0ccc000000c00cc000000c0c0ccc0ccc00c000000ccc0cc000cc0000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000008808800000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000088888780000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000088888880000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000008888800000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000888000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000 +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 + +__sfx__ +0110000000472004620c3400c34318470004311842500415003700c30500375183750c3000c3751f4730c375053720536211540114330c37524555247120c3730a470163521d07522375164120a211220252e315 +01100000183732440518433394033c65539403185432b543184733940318433394033c655306053940339403184733940318423394033c655394031845321433184733940318473394033c655394033940339403 +01100000247552775729755277552475527755297512775524755277552b755277552475527757297552775720755247572775524757207552475227755247522275526757297552675722752267522975526751 +01100000001750c055003550c055001750c055003550c05500175180650c06518065001750c065003650c065051751106505365110650c17518075003650c0650a145160750a34516075111451d075113451d075 +011000001b5771f55722537265171b5361f52622515265121b7771f76722757267471b7461f7362271522712185771b5571d53722517187361b7261d735227122454527537295252e5171d73514745227452e745 +01100000275422754227542275422e5412e5452b7412b5422b5452b54224544245422754229541295422954224742277422e7422b7422b5422b5472954227542295422b742307422e5422e7472b547305462e742 +0110000030555307652e5752b755295622e7722b752277622707227561297522b072295472774224042275421b4421b5451b5421b4421d542295471d442295422444624546245472444727546275462944729547 +0110000000200002000020000200002000020000200002000020000200002000020000200002000020000200110171d117110171d227131211f227130371f2370f0411b1470f2471b35716051221571626722367 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e775000002e1752e075000002e1752e77500000 +__music__ +00 00044208 +00 00044108 +00 00010304 +00 00010304 +01 00010203 +00 00010203 +00 00010305 +00 00010306 +00 00010305 +00 00010306 +00 00010245 +02 00010243 + diff --git a/demos/jelpi.p8 b/demos/jelpi.p8 new file mode 100644 index 0000000..59491fb --- /dev/null +++ b/demos/jelpi.p8 @@ -0,0 +1,2591 @@ +pico-8 cartridge // http://www.pico-8.com +version 41 +__lua__ +-- jelpi demo +-- by zep + +level=1 + +num_players = 1 +corrupt_mode = false +paint_mode = false +max_actors = 64 +play_music = true + +function make_actor(k,x,y,d) + local a = { + k=k, + frame=0, + frames=4, + life = 1, + hit_t=0, + x=x,y=y,dx=0,dy=0, + homex=x,homey=y, + ddx = 0.02, -- acceleration + ddy = 0.06, -- gravity + w=3/8,h=0.5, -- half-width + d=d or -1, -- direction + bounce=0.8, + friction=0.9, + can_bump=true, + dash=0, + super=0, + t=0, + standing = false, + draw=draw_actor, + move=move_actor, + } + + -- attributes by flag + + if (fget(k,6)) then + a.is_pickup=true + end + + if (fget(k,7)) then + a.is_monster=true + a.move=move_monster + end + + if (fget(k,4)) then + a.ddy = 0 -- zero gravity + end + + -- attributes from actor_dat + + for k,v in pairs(actor_dat[k]) + do + a[k]=v + end + + if (#actor < max_actors) then + add(actor, a) + end + + return a +end + +function make_sparkle(k,x,y,col) + local s = { + x=x,y=y,k=k, + frames=1, + col=col, + t=0, max_t = 8+rnd(4), + dx = 0, dy = 0, + ddy = 0 + } + if (#sparkle < 512) then + add(sparkle,s) + end + return s +end + +function make_player(k, x, y, d) + + local a = make_actor(k, x, y, d) + + a.is_player=true + a.move=move_player + + a.score = 0 + a.bounce = 0 + a.delay = 0 + a.id = 0 -- player 1 + + + return a +end + + + + +-- called at start by pico-8 +function _init() + + init_actor_data() + init_level(level) + + menuitem(1, + "restart level", + function() + init_level(level) + end) + +end + +-- clear_cel using neighbour val +-- prefer empty, then non-ground +-- then left neighbour + +function clear_cel(x, y) + local val0 = mget(x-1,y) + local val1 = mget(x+1,y) + if ((x>0 and val0 == 0) or + (x<127 and val1 == 0)) then + mset(x,y,0) + elseif (not fget(val1,1)) then + mset(x,y,val1) + elseif (not fget(val0,1)) then + mset(x,y,val0) + else + mset(x,y,0) + end +end + + +function move_spawns(x0, y0) + + x0=flr(x0) + y0=flr(y0) + + -- spawn actors close to x0,y0 + + for y=0,16 do + for x=x0-10,max(16,x0+14) do + local val = mget(x,y) + + -- actor + if (fget(val, 5)) then + m = make_actor(val,x+0.5,y+1) + clear_cel(x,y) + end + + end + end + +end + +-- test if a point is solid +function solid (x, y, ignore) + + if (x < 0 or x >= 128 ) then + return true end + + local val = mget(x, y) + + -- flag 6: can jump up through + -- (and only top half counts) + if (fget(val,6)) then + if (ignore) return false + -- bottom half: solid iff solid below + if (y%1 > 0.5) return solid(x,y+1) + end + + return fget(val, 1) +end + +-- solidx: solid at 2 points +-- along x axis +local function solidx(x,y,w) + return solid(x-w,y) or + solid(x+w,y) +end + + +function move_player(pl) + + move_actor(pl) + + if (pl.y > 18) pl.life=0 + + local b = pl.id + + if (pl.life <= 0) then + + for i=1,32 do + s=make_sparkle(69, + pl.x, pl.y-0.6) + s.dx = cos(i/32)/2 + s.dy = sin(i/32)/2 + s.max_t = 30 + s.ddy = 0.01 + s.frame=69+rnd(3) + s.col = 7 + end + + sfx(17) + pl.death_t=time() + + + return + end + + local accel = 0.05 + local q=0.7 + + if (pl.dash > 10) then + accel = 0.08 + end + + if (pl.super > 0) then + q*=1.5 + accel*=1.5 + end + + if (not pl.standing) then + accel = accel / 2 + end + + -- player control + if (btn(0,b)) then + pl.dx = pl.dx - accel; pl.d=-1 end + if (btn(1,b)) then + pl.dx = pl.dx + accel; pl.d=1 end + + if ((btn(4,b)) and + pl.standing) then + pl.dy = -0.7 + sfx(8) + end + + -- charge + + if (btn(5,b) and pl.delay == 0) + then + pl.dash = 15 + pl.delay= 20 + -- charge in dir of buttons + dx=0 dy=0 + if (btn(0,b)) dx-=1*q + if (btn(1,b)) dx+=1*q + + -- keep controls to 4 btns + if (btn(2,b)) dy-=1*q + if (btn(3,b)) dy+=1*q + + if (dx==0 and dy==0) then + pl.dx += pl.d * 0.4 + else + local aa=atan2(dx,dy) + pl.dx += cos(aa)/2 + pl.dy += sin(aa)/3 + + pl.dy=max(-0.5,pl.dy) + end + + -- tiny extra vertical boost + if (not pl.standing) then + pl.dy = pl.dy - 0.2 + end + + sfx(11) + + end + + -- super: give more dash + + if (pl.super > 0) pl.dash=2 + + -- dashing + + if pl.dash > 0 then + + if (abs(pl.dx) > 0.4 or + abs(pl.dy) > 0.2 + ) then + + for i=1,3 do + local s = make_sparkle( + 69+rnd(3), + pl.x+pl.dx*i/3, + pl.y+pl.dy*i/3 - 0.3, + (pl.t*3+i)%9+7) + if (rnd(2) < 1) then + s.col = 7 + end + s.dx = -pl.dx*0.1 + s.dy = -0.05*i/4 + s.x = s.x + rnd(0.6)-0.3 + s.y = s.y + rnd(0.6)-0.3 + end + end + end + + pl.dash = max(0,pl.dash-1) + pl.delay = max(0,pl.delay-1) + pl.super = max(0, pl.super-1) + + -- frame + + if (pl.standing) then + pl.frame = (pl.frame+abs(pl.dx)*2) % pl.frames + else + pl.frame = (pl.frame+abs(pl.dx)/2) % pl.frames + end + + if (abs(pl.dx) < 0.1) pl.frame = 0 + +end + +function move_monster(m) + + move_actor(m) + + if (m.life<=0) then + bang_puff(m.x,m.y-0.5,104) + + sfx(14) + return + end + + + m.dx = m.dx + m.d * m.ddx + + m.frame = (m.frame+abs(m.dx)*3+4) % m.frames + + -- jump + if (false and m.standing and rnd(10) < 1) + then + m.dy = -0.5 + end + + -- hit cooldown + -- (can't get hit twice within + -- half a second) + if (m.hit_t>0) m.hit_t-=1 + +end + + +function smash(x,y,b) + + local val = mget(x, y, 0) + if (not fget(val,4)) then + -- not smashable + -- -> pass on to solid() + return solid(x,y,b) + end + + + -- spawn + if (val == 48) then + local a=make_actor( + loot[#loot], + x+0.5,y-0.2) + + a.dy=-0.8 + a.d=flr(rnd(2))*2-1 + a.d=0.25 -- swirly + loot[#loot]=nil + end + + + clear_cel(x,y) + sfx(10) + + -- make debris + + for by=0,1 do + for bx=0,1 do + s=make_sparkle(22, + 0.25+flr(x) + bx*0.5, + 0.25+flr(y) + by*0.5, + 0) + s.dx = (bx-0.5)/4 + s.dy = (by-0.5)/4 + s.max_t = 30 + s.ddy = 0.02 + end + end + + return false -- not solid +end + +function move_actor(a) + + if (a.life<=0) del(actor,a) + + a.standing=false + + -- when dashing, call smash() + -- for any touched blocks + -- (except for landing blocks) + local ssolid= + a.dash>0 and smash or solid + + -- solid going down -- only + -- smash when holding down + local ssolidd= + a.dash>0 and (btn(3,a.id)) + and smash or solid + + --ignore jump-up-through + --blocks only when have gravity + local ign=a.ddy > 0 + + -- x movement + + -- candidate position + x1 = a.x + a.dx + sgn(a.dx)/4 + + if not ssolid(x1,a.y-0.5,ign) + then + -- nothing in the way->move + a.x += a.dx + + else -- hit wall + + -- bounce + if (a.dash > 0)sfx(12) + a.dx *= -1 + + a.hit_wall=true + + -- monsters turn around + if (a.is_monster) then + a.d *= -1 + a.dx = 0 + end + + end + + -- y movement + + local fw=0.25 + + if (a.dy < 0) then + -- going up + + if ( + ssolid(a.x-fw, a.y+a.dy-1,ign) or + ssolid(a.x+fw, a.y+a.dy-1,ign)) + then + a.dy=0 + + -- snap to roof + a.y=flr(a.y+.5) + + else + a.y += a.dy + end + + else + -- going down + + local y1=a.y+a.dy + if ssolidd(a.x-fw,y1) or + ssolidd(a.x+fw,y1) + then + + -- bounce + if (a.bounce > 0 and + a.dy > 0.2) + then + a.dy = a.dy * -a.bounce + else + + a.standing=true + a.dy=0 + end + + -- snap to top of ground + a.y=flr(a.y+0.75) + + else + a.y += a.dy + end + -- pop up + + while solid(a.x,a.y-0.05) do + a.y -= 0.125 + end + + end + + + -- gravity and friction + a.dy += a.ddy + a.dy *= 0.95 + + -- x friction + + a.dx *= a.friction + if (a.standing) then + a.dx *= a.friction + end + +--end + + -- counters + a.t = a.t + 1 +end + + +function monster_hit(m) + if(m.hit_t>0) return + + m.life-=1 + m.hit_t=15 + m.dx/=4 + m.dy/=4 + -- survived: thunk sound + if (m.life>0) sfx(21) + +end + +function player_hit(p) + if (p.dash>0) return + p.life-=1 +end + +function collide_event(a1, a2) + + if (a1.is_monster and + a1.can_bump and + a2.is_monster) then + local d=sgn(a1.x-a2.x) + if (a1.d!=d) then + a1.dx=0 + a1.d=d + end + end + + -- bouncy mushroom + if (a2.k==82) then + if (a1.dy > 0 and + not a1.standing) then + a1.dy=-1.1 + a2.active_t=6 + sfx(18) + end + end + + if(a1.is_player) then + if(a2.is_pickup) then + + if (a2.k==64) then + a1.super = 30*4 + --sfx(17) + a1.dx = a1.dx * 2 + --a1.dy = a1.dy-0.1 + -- a1.standing = false + sfx(13) + end + + -- watermelon + if (a2.k==80) then + a1.score+=5 + sfx(9) + end + + -- end level + if (a2.k==65) then + finished_t=1 + bang_puff(a2.x,a2.y-0.5,108) + del(actor,pl[1]) + del(actor,pl[2]) + music(-1,500) + sfx(24) + end + + -- glitch mushroom + if (a2.k==84) then + glitch_mushroom = true + sfx(29) + end + + -- gem + if (a2.k==67) then + a1.score = a1.score + 1 + + -- total gems between players + gems+=1 + + end + + -- bridge builder + if (a2.k==99) then + local x,y=flr(a2.x)+.5,flr(a2.y+0.5) + for xx=-1,1 do + if (mget(x+xx,y)==0) then + local a=make_actor(53,x+xx,y+1) + a.dx=xx/2 + end + end + end + + a2.life=0 + + s=make_sparkle(85,a2.x,a2.y-.5) + s.frames=3 + s.max_t=15 + sfx(9) + end + + -- charge or dupe monster + + if(a2.is_monster) then -- monster + + if( + (a1.dash > 0 or + a1.y < a2.y-a2.h/2) + and a2.can_bump + ) then + + -- slow down player + a1.dx *= 0.7 + a1.dy *= -0.7 + + if (btn(🅾️,a1.id))a1.dy -= .5 + + monster_hit(a2) + + else + -- player death + a1.life=0 + + end + end + + end +end + +function move_sparkle(sp) + if (sp.t > sp.max_t) then + del(sparkle,sp) + end + + sp.x = sp.x + sp.dx + sp.y = sp.y + sp.dy + sp.dy= sp.dy+ sp.ddy + sp.t = sp.t + 1 +end + + +function collide(a1, a2) + if (not a1) return + if (not a2) return + + if (a1==a2) then return end + local dx = a1.x - a2.x + local dy = a1.y - a2.y + if (abs(dx) < a1.w+a2.w) then + if (abs(dy) < a1.h+a2.h) then + collide_event(a1, a2) + collide_event(a2, a1) + end + end +end + +function collisions() + + -- to do: optimize if too + -- many actors + + for i=1,#actor do + for j=i+1,#actor do + collide(actor[i],actor[j]) + end + end + +end + + + +function outgame_logic() + + if death_t==0 and + not alive(pl[1]) and + not alive(pl[2]) then + death_t=1 + music(-1) + sfx(5) + + end + + if (finished_t > 0) then + + finished_t += 1 + + if (finished_t > 60) then + if (btnp(❎)) then + fade_out() + init_level(level+1) + end + end + + end + + if (death_t > 0) then + death_t = death_t + 1 + if (death_t > 45 and + btn()>0) + then + music(-1) + sfx(-1) + sfx(0) + fade_out() + + + -- restart cart end of slice + init_level(level) + end + end + +end + +function _update() + + for a in all(actor) do + a:move() + end + + foreach(sparkle, move_sparkle) + collisions() + + for i=1,#pl do + move_spawns(pl[i].x,0) + end + + outgame_logic() + update_camera() + + if (glitch_mushroom or corrupt_mode) then + for i=1,4 do + poke(rnd(0x8000),rnd(0x100)) + end + end + + level_t += 1 +end + + + +function _draw() + + cls(12) + + -- view width + local vw=split and 64 or 128 + + cls() + + -- decide which side to draw + -- player 1 view + local view0_x = 0 + if (split and pl[1].x>pl[2].x) + then view0_x = 64 end + + -- player 1 (or whole screen) + draw_world( + view0_x,0,vw,128, + cam_x,cam_y) + + -- player 2 view if needed + if (split) then + cam_x = pl_camx(pl[2].x,64) + draw_world(64-view0_x,0,vw,128, + cam_x, cam_y) + end + + camera()pal()clip() + if (split) line(64,0,64,128,0) + + -- player score + camera(0,0) + color(7) + + if (death_t > 45) then + print("❎ restart", + 44,10+1,14) + print("❎ restart", + 44,10,7) + end + + if (finished_t > 0) then + draw_finished(finished_t) + end + + if (paint_mode) apply_paint() + + draw_sign() +end + + +sign_str={ +"", +[[ + this is an empty level! + use the map editor to add + some blocks and monsters. + in the code editor you + can also set level=2 + ]], +"", +[[ + this is not a level! + + the bottom row of the map + in this cartridge is used + for making backgrounds. +]] +} + +function draw_sign() + +if (mget(pl[1].x,pl[1].y-0.5)!=25) return + +rectfill(8,6,120,46,0) +rect(8,6,120,46,7) + +print(sign_str[level],12,12,6) + + +end + + +function fade_out() + + dpal={0,1,1, 2,1,13,6, + 4,4,9,3, 13,1,13,14} + + + + -- palette fade + for i=0,40 do + for j=1,15 do + col = j + for k=1,((i+(j%5))/4) do + col=dpal[col] + end + pal(j,col,1) + end + flip() + end + +end +-->8 +-- draw world + +function draw_sparkle(s) + + --spinning + if (s.k == 0) then + local sx=s.x*8 + local sy=s.y*8 + + line(sx,sy, + sx+cos(s.t*s.spin)*1.4, + sy+sin(s.t*s.spin)*1.4, + s.col) + + return + end + + if (s.col and s.col > 0) then + for i=1,15 do + pal(i,s.col) + end + end + + local fr=s.frames * s.t/s.max_t + fr=s.k+mid(0,fr,s.frames-1) + spr(fr, s.x*8-4, s.y*8-4) + + pal() +end + +function draw_actor(a) + + local fr=a.k + a.frame + + -- rainbow colour when dashing + if (a.dash>0) for i=2,15 do pal(i,7+((a.t/2) % 8)) end + + local sx=a.x*8-4 + local sy=a.y*8-8 + + -- sprite flag 3 (green): + -- draw one pixel up + if (fget(fr,3)) sy-=1 + + -- draw the sprite + spr(fr, sx,sy,1,1,a.d<0) + + -- sprite flag 2 (yellow): + -- repeat top line + -- (for mimo's ears!) + + if (fget(fr,2)) then + pal(14,7) + spr(fr,sx,sy-1,1,1/8, + a.d<0) + end + + pal() +end + +function draw_tail(a) + + draw_actor(a) + + local sx=a.x*8 + local sy=a.y*8-2 + local d=-a.d + sx += d*3 + if (a.d>0) sx-=1 + + for i=0,4,2 do + pset(sx+i*d*1, + sy + cos(i/16-time())* + (1+i)*abs(a.dx)*4,7) + end + +end + + +function apply_paint() + if (tt==nil) tt=0 + tt=tt+0.25 + srand(flr(tt)) + local nn=rnd(128) + local xx=0 + local yy=nn&127 + for i=1,1000*13,13 do + nn+=i + nn*=33 + xx=nn&127 + local col=pget(xx,yy) + rectfill(xx,yy,xx+1,yy+1,col) + line(xx-1,yy-1,xx+2,yy+2,col) + nn+=i + nn*=57 + yy=nn&127 + rectfill(xx-1,yy-1,xx,yy,pget(xx,yy)) + + end +end + +-- draw the world at sx,sy +-- with a view size: vw,vh +function draw_world( + sx,sy,vw,vh,cam_x,cam_y) + + -- reduce jitter + cam_x=flr(cam_x) + cam_y=flr(cam_y) + + if (level>=4) cam_y = 0 + + clip(sx,sy,vw,vh) + cam_x -= sx + + local ldat=theme_dat[level] + if (not ldat) ldat={} + + -- sky + camera (cam_x/4, cam_y/4) + + -- sample palette colour + local colx=120+level + + -- sky gradient + if (ldat.sky) then + for y=cam_y,127 do + col=ldat.sky[ + flr(mid(1,#ldat.sky, + (y+(y%4)*6) / 16))] + + line(0,y,511,y,col) + end + end + + -- elements + + + for pass=0,1 do + camera() + + for el in all(ldat.bgels) do + + if (pass==0 and el.xyz[3]>1) or + (pass==1 and el.xyz[3]<=1) + then + + pal() + if (el.cols) then + for i=1,#el.cols, 2 do + if (el.cols[i+1]==-1) then + palt(el.cols[i],true) + else + pal(el.cols[i],el.cols[i+1]) + end + end + end + + local s=el.src + local pixw=s[3] * 8 + local pixh=s[4] * 8 + local sx=el.xyz[1] + if (el.dx) then + sx += el.dx*t() + end + local sy=el.xyz[2] + + sx = (sx-cam_x)/el.xyz[3] + sy = (sy-cam_y)/el.xyz[3] + + repeat + map(s[1],s[2],sx,sy,s[3],s[4]) + if (el.fill_up) then + rectfill(sx,-1,sx+pixw-1,sy-1,el.fill_up) + end + if (el.fill_down) then + rectfill(sx,sy+pixh,sx+pixw-1,128,el.fill_down) + end + sx+=pixw + + until sx >= 128 or not el.xyz[4] + + end + end + pal() + + if (pass==0) then + draw_z1(cam_x,cam_y) + end + end + + + + clip() + +end + + +-- map and actors +function draw_z1(cam_x,cam_y) + + camera (cam_x,cam_y) + pal(12,0) -- 12 is transp + map (0,0,0,0,128,64,0) + pal() + foreach(sparkle, draw_sparkle) + for a in all(actor) do + pal() + if (a.hit_t>0 and a.t%4 < 2) then + for i=1,15 do + pal(i,8+(a.t/4)%4) + end + end + a:draw() -- same as a.draw(a) + end + -- forground map + map (0,0,0,0,128,64,1) +end + + +-->8 +-- explosions + +function bang_puff(mx,my,sp) + + local aa=rnd(1) + for i=0,5 do + + local dx=cos(aa+i/6)/4 + local dy=sin(aa+i/6)/4 + local s=make_sparkle( + sp,mx + dx, my + dy) + s.dx = dx + s.dy = dy + s.max_t=10 + end + +end + +function atomize_sprite(s,mx,my,col) + + local sx=(s%16)*8 + local sy=flr(s/16)*8 + local w=0.04 + + for y=0,7 do + for x=0,7 do + if (sget(sx+x,sy+y)>0) then + local q=make_sparkle(0, + mx+x/8, + my+y/8) + q.dx=(x-3.5)/32 +rnd(w)-rnd(w) + q.dy=(y-7)/32 +rnd(w)-rnd(w) + q.max_t=20+rnd(20) + q.t=rnd(10) + q.spin=0.05+rnd(0.1) + if (rnd(2)<1) q.spin*=-1 + q.ddy=0.01 + q.col=col or sget(sx+x,sy+y) + end + end + end + +end +-->8 +-- camera + +-- (camera y is lazy) +ccy_t=0 +ccy =0 + +-- splitscreen (multiplayer) +split=false + +-- camera x for player i +function pl_camx(x,sw) + return mid(0,x*8-sw/2,1024-sw) +end + + +function update_camera() + + local num=0 + if (alive(pl[1])) num+=1 + if (alive(pl[2])) num+=1 + + split = num==2 and + abs(pl_camx(pl[1].x,64) - + pl_camx(pl[2].x,64)) > 64 + + -- camera y target changes + -- when standing. quantize y + -- into 2 blocks high so don't + -- get small adjustments + -- (should be in _update) + + if (num==2) then + -- 2 active players: average y + ccy_t=0 + for i=1,2 do + ccy_t += (flr(pl[i].y/2+.5)*2-12)*3 + end + ccy_t/=2 + else + + -- single: set target only + -- when standing + for i=1,#pl do + if (alive(pl[i]) and + pl[i].standing) then + ccy_t=( + flr(pl[i].y/2+.5)*2-12 + )*3 + end + end + end + + -- target always <= 0 + ccy_t=min(0,ccy_t) + + ccy = ccy*7/8+ccy_t*1/8 + cam_y = ccy + + local xx=0 + local qq=0 + for i=1,#pl do + if (alive(pl[i])) then + local q=1 + + -- pan across when first + -- player dies and not in + -- split screen + if (pl[i].life<=0 and pl[i].death_t) then + q=time()-pl[i].death_t + q=mid(0,1-q*2,1) + q*=q + end + + xx+=pl[i].x * q + qq += q + end + end + + if (split) then + cam_x = pl_camx(pl[1].x,64) + elseif qq>0 then + cam_x = pl_camx(xx/qq,128) + end + +end +-->8 +-- actors + +function init_actor_data() + +function dummy() end + +actor_dat= +{ + -- bridge builder + [53]={ + ddy=0, + friction=1, + move=move_builder, + draw=dummy + }, + + [64]={ + draw=draw_charge_powerup + }, + + [65]={ + draw=draw_exit + }, + + -- swirly + [80]={ + life=2, + frames=1, + bounce=0, + ddy=0, -- gravity + move=move_swirly, + draw=draw_swirly, + can_bump=false, + d=0.25, + r=5 -- collisions + }, + + -- bouncy mushroom + [82]={ + ddx=0, + frames=1, + active_t=0, + move=move_mushroom + }, + + -- glitch mushroom + [84]={ + draw=draw_glitch_mushroom + }, + + -- bird + [93]={ + move=move_bird, + draw=draw_bird, + + bounce=0, + ddy=0.03,-- default:0.06 + }, + + -- frog + [96]={ + move=move_frog, + draw=draw_frog, + bounce=0, + friction=1, + tongue=0, + tongue_t=0 + }, + + [116]={ + draw=draw_tail + } + +} + +end + + + +function move_builder(a) + + local x,y=a.x,a.y-0.5 + local val=mget(x,y) + if val==0 then + mset(x,y,53) + sfx(19) + elseif val!=53 + then + del(actor,a) + end + a.t += 1 + + if (x<1 or x>126 or a.t > 30) + then del(actor,a) end + + for i=0,0.2,0.1 do + local s=make_sparkle( + 104,a.x,a.y-0.5) + s.dx=cos(i+a.x/4)/8 + s.dy=sin(i+a.x/4)/8 + s.col=10 + s.max_t=10+rnd(10) + end + + a.x+=a.dx +end + +function move_frog(a) + + move_actor(a) + + if (a.life<=0) then + bang_puff(a.x,a.y-0.5,104) + sfx(26) + end + + a.frame=0 + + local p=closest_p(a,16) + + + if (a.standing) then + a.dy=0 a.dx=0 + + -- jump + + if (rnd(20)<1 and + a.tongue_t==0) then -- jump freq + -- face player 2/3 times + if rnd(3)<2 and p then + a.d=sgn(p.x-a.x) + end + a.dy=-0.6-rnd(0.4) + a.dx=a.d/4 + a.standing=false + sfx(23) + end + else + a.frame=1 + end + + -- move tongue + + -- stick tongue out when standing + if a.tongue_t==0 and + p and abs(a.x-p.x)<5 and + rnd(20)<1 and + a.standing then + a.tongue_t=1 + end + + -- move active tongue + if (a.tongue_t>0) then + a.frame=2 + a.tongue_t = (a.tongue_t+1)%24 + local tlen = sin(a.tongue_t/48)*5 + a.tongue_x=a.x-tlen*a.d + + -- catch player + + if not a.ha and p then + local dx=p.x-a.tongue_x + local dy=p.y-a.y + if (dx*dx+dy*dy<0.7^2) + then a.ha=p sfx(22) end + end + + -- skip to retracting + if (solid(a.tongue_x, + a.y-.5) and + a.tongue_t < 11) then + a.tongue_t = 24-a.tongue_t + end + end + + -- move caught actor + if (a.ha) then + if (a.tongue_t>0) then + a.ha.x = a.tongue_x + a.ha.y = a.y + else + a.ha=nil + end + end + + --a.tongue=1 -- tiles + + a.t += 1 +end + + +function draw_frog(a) + draw_actor(a) + + local sx=a.x*8+a.d*4 + local sy=a.y*8-3 + local d=a.d + + + if (a.tongue_t==0 or not a.tongue_t) return + + local sx2=a.tongue_x*8 + local sy2=(a.y+0.25)*8 + line(sx,sy,sx2,sy,8) + rectfill(sx2,sy,sx2+d,sy-1,14) +end + +function draw_charge_powerup(a) + --pal(6,13+(a.t/4)%3) + draw_actor(a) + local sx=a.x*8 + local sy=a.y*8-4 + for i=0,5 do + circfill( + sx+cos(i/6+time()/2)*5.5, + sy+sin(i/6+time()/2)*5.5, + (i+time()*3)%1.5,7) + end + +end + +function move_mushroom(a) + a.frame=0 + if (a.active_t>0) then + a.active_t-=1 + a.frame=1 + end +end + +function draw_glitch_mushroom(a) + local sx=a.x*8 + local sy=a.y*8-4 + + draw_actor(a) + + + dx=cos(time()*5)*3 + dy=sin(time()*3)*3 + + for y=sy-12,sy+12 do + for x=sx-12,sx+12 do + local d=sqrt((y-sy)^2+(x-sx)^2) + if (d<12 and + cos(d/5-time()*2)>.4) then + pset(x,y,pget(x+dx,y+dy) + +rnd(1.5)) +-- pset(x,y,rnd(16)) + end + end + end + + pset(sx,sy,rnd(16)) + + draw_actor(a) +end + +function draw_exit(a) + local sx=a.x*8 + local sy=a.y*8-4 + + sy += cos(time()/2)*1.5 + + circfill(sx-1+cos(time()*1.5),sy,3.5+cos(time()),8) + circfill(sx+1+cos(time()*1.3),sy,3.5+cos(time()),12) + circfill(sx,sy,3,7) + + for i=0,3 do + circfill( + sx+cos(i/8+time()*.6)*6, + sy+sin(i/5+time()*.4)*6, + 1.5+cos(i/7+time()), + 8+i%5) + circfill( + sx+cos(.5+i/7+time()*.9)*5, + sy+sin(.5+i/9+time()*.7)*5, + .5+cos(.5+i/7+time()), + 14+i%2) + end + +end + + +function turn_to(a,ta,spd) + + a %=1 + ta%=1 + + while (ta < a-.5) ta += 1 + while (ta > a+.5) ta -= 1 + + if (ta > a) then + a = min(ta, a + spd) + else + a = max(ta, a - spd) + end + + return a +end + +function move_swirly(a) + + -- dying + if (a.life==0 and a.t%4==0) then + + local tail=a.tail[1] + local s=tail[#tail] + + local cols= {7,15,14,15} + -- reuse + atomize_sprite(64,s.x-.5,s.y-.5,cols[1+#tail%#cols]) + del(tail,s) sfx(26) + if (s==a) del(actor,a) sfx(27) + + end + + local ah=a.holding + + if (ah and a.tail and a.tail[1][15]) then + ah.x=a.tail[1][15].x + ah.y=a.tail[1][15].y + + ah.dy=-0.1 -- don't land + if (a.standing) ah.x-=a.d/2 + if (ah.life==0) a.holding=nil + end + + a.t += 1 + if (a.hit_t>0) a.hit_t-=1 + + if (a.t < 20) then + a.dx *=.95 + a.dy *=.95 + end + + a.x+=a.dx + a.y+=a.dy + a.dx *=.95 + a.dy *=.95 + + local tx=a.homex + local ty=a.homey + local p=closest_p(a,200) + if (p) tx,ty=p.x,p.y + + -- local variation +-- tx += cos(a.t/60)*3 +-- ty += sin(a.t/40)*3 + + local turn_spd=1/60 + local accel = 1/64 + + -- charge 3 seconds + -- swirl 3 seconds + if ((a.t%360 < 180 + and a.life > 1) + or a.life==0) and + abs(a.x-tx<12) then + ty -= 6 + else + -- heat-seeking + -- instant turn, but inertia + -- means still get swirls + turn_spd=1/30 + accel=1/40 + if (abs(a.x-tx)>12)accel*=1.5 + end + + + a.d=turn_to(a.d, + atan2(tx-a.x,ty-a.y), + turn_spd + ) + + + a.dx += cos(a.d)*accel + a.dy += sin(a.d)*accel + + -- spawn tail + if (not a.tail) then + a.tail={} + for j=1,3 do + + a.tail[j]={} + for i=1,15 do + local r=5-i*4/15 + r=mid(1,r,4) + local slen=r/9 + 0.3 + if (j>1) then + r=r/3 slen=0.3 + --if (i==1) slen=0 + end + + local seg={ + x=a.x-cos(a.d)*i/8, + y=a.y-sin(a.d)*i/8, + r=r,slen=slen + } + + add(a.tail[j],seg) + + end + a.tail[j][0]=a + end + + end + + -- move tail + + for j=1,3 do + for i=1,#a.tail[j] do + + local s=a.tail[j][i] + local h=a.tail[j][i-1] + local slen=s.len + local hx = h.x + local hy = h.y + + if (i==1) then + if (j==2) hx -=.5 --hy-=.7 + if (j==3) hx +=.5 --hy-=.7 + end + + local dx=hx-s.x + local dy=hy-s.y + + local aa=atan2(dx,dy) + + if (j==2) aa=turn_to(aa,7/8,0.02) + if (j==3) aa=turn_to(aa,3/8,0.02) + s.x=hx-cos(aa)*s.slen + s.y=hy-sin(aa)*s.slen + end + end + + -- players collide with tail + + for i=0,#a.tail[1] do + for pi=1,#pl do + local p=pl[pi] + if (alive(p) and a.life>0 and + p.life>0) then + s = a.tail[1][i] + local r=s.r/8 -- from pixels + local dx=p.x-s.x + local dy=(p.y-0.5)-s.y + local dd=sqrt(dx*dx+dy*dy) + local rr=0.5+r + if (dd<0.5+r) then + // janky bounce away + local aa=atan2(dx,dy) + aa+=rnd(0.4)-rnd(0.4) + p.dx=cos(aa)/2 + p.dy=sin(aa)/2 + if (p.is_standing) p.dy=min(p.dy,-0.2) + sfx(19) + + if (p.dash>0) then + if (i==0) monster_hit(a) + else + player_hit(p) + end + + end + end + end + end + + +end + + +function draw_swirly(a) + + if (not a.tail) return + + for j=1,3 do + for i=#a.tail[j],1,-1 do + seg=a.tail[j][i] + local sx=seg.x*8 + local sy=seg.y*8 + + cols = {7,15,14,15,7,7} + cols2 = {6,14,8,14,6,6} + local q= a.life==1 and 4 or 6 + local c=1+flr(i-time()*16)%q + + if (j>1) then + if (i%2==0) then + circfill(sx,sy,1,8) + else + pset(sx,sy,10) + end + else + local r=seg.r+cos(i/8-time())/2 + r=mid(1,r,5) + r=seg.r + circfill(sx,sy+r/2,r,cols2[c]) + circfill(sx,sy,r,cols[c]) + end + + end + end + + local sx=a.x*8 + local sy=a.y*8-4 + --circ(sx,sy+4,5,rnd(16)) + + -- mouth + spr(81,sx-4,sy+5+ + flr(cos(a.t/30))) + -- head + spr(80,sx-8,sy) + spr(80,sx+0,sy,1,1,true) +-- + + +end + +function alive(a) + if (not a) return false + if (a.life <=0 and + (a.death_t and + time() > a.death_t+0.5) + ) then return false end + return true +end + +-- ignore everything more than +-- 8 blocks away horizontally +function closest_a(a0,l,attr,maxdx) + local best + local best_d + for i=1,#l do + if not attr or l[i][attr] then + local dx=l[i].x-a0.x + local dy=l[i].y-a0.y + d=dx*dx+dy*dy + if (not best or d 0 + and (not maxdx or + abs(dx)ty) mag=.4 + + -- wall: fly to top + if (a.hit_wall)mag=.45 + + -- player can shoo upwards + if (p and a.y>ty and not ah) mag=.45 + + a.hit_wall = false + a.dy-=mag + end + + + if (a.dy<0.2) then + a.dx+=a.d/64 + end + + end + + a.frame=a.standing and 0 or + 1+(a.t/4)%2 + +end + + +function draw_bird(a) + local q=flr(a.t/8) + if ((q^2)%11<1) pal(1,15) + + draw_actor(a) + + -- debug: show target + --[[ + if (a.tx) then + local sx=a.tx*8 + local sy=a.ty*8 + circfill(sx,sy,1,rnd(16)) + end + ]] +end +-->8 +-- themes (backgrounds) + + +theme_dat={ + +[1]={ + sky={12,12,12,12,12}, + bgels={ + + { + -- clouds + src={16,56,16,8}, + xyz = {0,28*4,4,true}, + dx=-8, + cols={15,7,1,-1}, + fill_down = 12 + }, + -- mountains + {src={0,56,16,8}, + xyz = {0,28*4,4,true}, + fill_down=13, + }, + + -- leaves: light + {src={32,48,16,6}, + xyz = {(118*8),-8,1.5}, + cols={1,3}, + fill_up=1 + }, + + -- leaves: dark (foreground) + {src={32,48,16,6}, + xyz = {(118*8),-12,0.8}, + cols={3,1}, + fill_up=1 + }, + + + } +}, + +-------------------------- +-- level 2 + +[2]={ + sky={12}, + bgels={ + + { + -- gardens + src={32,56,16,8}, + xyz = {0,100,4,true}, + --cols={7,6,15,6}, + cols={3,13,7,13,10,13,1,13,11,13,9,13,14,13,15,13,2,13}, + + fill_down=13 + }, + { + -- foreground shrubbery + src={16,56,16,8}, + xyz = {0,64*0.8,0.6,true}, + cols={15,1,7,1}, + fill_down = 12 + }, + -- foreground shrubbery feature + { + src={32,56,8,8}, + xyz = {60,60*0.9,0.8,false}, + cols={15,1,7,1,3,1,11,1,10,1,9,1}, + }, + -- foreground shrubbery feature + { + src={32,56,8,8}, + xyz = {260,60*0.9,0.8,false}, + cols={15,1,7,1,3,1,11,1,10,1,9,1}, + }, + + + -- leaves: indigo + {src={32,48,16,6}, + xyz = {40,64,4,true}, + cols={1,13,3,13}, + fill_up=13 + }, + + -- leaves: light + {src={32,48,16,6}, + xyz = {0,-4,1.5,true}, + cols={1,3}, + fill_up=1 + }, + + -- leaves: dark (foreground) + {src={32,48,16,6}, + xyz = {-40,-6,0.8,true}, + cols={3,1}, + fill_up=1 + } + + + + }, +}, + ---------------- + +-- double mountains + +[3]={ + sky={12,14,14,14,14}, + bgels={ + + + -- mountains indigo (far) + {src={0,56,16,8}, + xyz = {-64,30,8,true}, + fill_down=13, + cols={6,15,13,6} + }, + + { + -- clouds inbetween + src={16,56,16,8}, + xyz = {0,50,8,true}, + dx=-30, + cols={15,7,1,-1}, + fill_down = 7 + }, + + -- mountains close + {src={0,56,16,8}, + xyz = {0,140,8,true}, + fill_down=13, + cols={6,5,13,1} + }, + + } +}, + +} + +function init_level(lev) + + cls()reset() + + level=lev + level_t = 0 + death_t = 0 + finished_t = 0 + gems = 0 + gem_sfx = {} + total_gems = 0 + glitch_mushroom = false + + music(-1) + + if play_music then + if (level==1) music(0) + if (level==2) music(4) + if (level==3) music(16) + + end + + actor = {} + sparkle = {} + pl = {} + loot = {} + + reload() + + if (level <= 4) then + -- copy section of map + memcpy(0x2000, + 0x1000+((lev+1)%4)*0x800, + 0x800) + end + + -- spawn player + for y=0,15 do for x=0,127 do + + local val=mget(x,y) + + if (val == 72) then + clear_cel(x,y) + pl[1] = make_player(72, x+0.5,y+0.5,1) + + if (num_players==2) then + pl[2] = make_player(88, x+2,y+1,1) + pl[2].id = 1 + end + + end + + -- count gems + if (val==67) then + total_gems+=1 + end + + -- lootboxes + if (val==48) then + add(loot,67) + end + end end + + local num_booby=0 + -- shuffle lootboxes + if (#loot > 1) then + -- ~25% are booby prizes + num_booby=flr((#loot+2) / 4) + for i=1,num_booby do + loot[i]=96 + if (rnd(10)<1) then + loot[i]=84 -- mushroom + end + end + + -- shuffle + for i=1,#loot do + -- swap 2 random items + j=flr(rnd(#loot))+1 + k=flr(rnd(#loot))+1 + loot[j],loot[k]=loot[k],loot[j] + end + end + + total_gems+= #loot-num_booby + + + if (not pl[1]) then + pl[1] = make_player(72,4,4,1) + end + +end + +-->8 +-- draw died / finished + +function draw_finished(tt) + + if (tt < 15) return + tt -= 15 + + local str="★ stage clear ★ " + + print(str,64-#str*2,31,14) + print(str,64-#str*2,30,7) + + -- gems + local n = total_gems + + for i=1,15 do pal(i,13) end + for pass=0,1 do + + for i=0,n-1 do + t2=tt-(i*4+15) + q=i=0 + if (pass == 0 or q) then + local y=50-pass + if (q) then + y+=sin(t2/8)*4/(t2/2) + if (not gem_sfx[i]) sfx(25) + gem_sfx[i]=true + end + + spr(67,64-n*4+i*8,y) + + end + end + + pal() + end + + if (tt > 45) then + print("❎ continue",42,91,12) + print("❎ continue",42,90,7) + end + +end + + +__gfx__ +000000002222222244444444bbbbbbbb00000000000aa000d7777777d66667d666666667d6666667cccccccccccccccccc5ccccccc5cccc5f777777767766666 +0000000022222222444444443333333300000000000990002eeeeeef5d66765d666666765d666676ccccccccccccccc5c55555ccc5555555effffff7d6766666 +0000000022222222444444443333333300000000a97770002eeeeeef55dd6655dddddd6655dddd66cccccccccccccc5555555ccc55555555effffff7dd666666 +0000000022222222444444443333333300000000a97779a02eeeeeef55dd6655dddddd6655dddd66ccccccccccccc555c555ccccc5555555eeeeeeef66666666 +0000000022222222444444443332332200070000007779a02eeeeeef55dd6655dddddd6655dddd66cccccccccccccc5ccc5ccccccc5ccc5c5555555566666776 +00000000222222224444444433223222007a7000009900002eeeeeef55dd6655dddddd6655dddd66ccccccccccc5555555cccccc5555c555dddddddd6666d676 +000000002222222244444444324224420007000000aa00002eeeeeef5111d651111111d6511111d6cccccccccc55c5555ccccccc55555555ddddd6dd6666dd66 +0000000022222222444444442444444200030000000300002222222d11111d111111111d1111111dccccccccc5555555cccccccc5555c5556666666666666666 +00700070555ddd661010122244440404bb0b000000000000000000000000000000000000000000000004400000044000000b0000000550006666666666666666 +0070007055dd666711101222444404440b3b000000000000000000000000000000000000444444440044240000bb2400000b3000000550006666660000666666 +0d7d0d7dc5d6667c0100112444442400003b00000000000000eff700000b000000000000414114249444424994223249000b3000000550006666000000006666 +06760777c5d6667c0111122244442400000b0bb000000000002eef00000b000000333300444444442494444224942342000b00000005d0006660000000000666 +11151115cc5667cc0000122244440000000b3b0000000000002eef00b00b000003333330422414140049440000494300000b00000005d0006600000000000066 +51555155cc5667cc0000112444444000000b30000000000000222e000b0b00b0333a3333444444440004400000b44000003b00000005d0006600000000000066 +55555555ccc67ccc0001222224444400000b000000000000000000000b0b0b0033a7a333000440000000000000030000003b00000005d0006000000000000006 +55555555ccc67ccc0011111224444440000b000000000000000000000b0b0b00333a33330004400000000000000b0000000b00000005d0006000000000000006 +444444444444444444444444444444444444444400000000333333333333333333333333bbbbbbbb000000000000000000000000000000008eeeeee800666600 +2244224444444444444444444466444444d6644400000000333333333333b33333333333bbbbbbbb000000000000000000000000000dd000288888880d666670 +42244224444224444464444442d6744442dd6744000000003339a3333333bab3333333333333333300000000000000000000000000dd770022222222dd666676 +44224424444422444666d44422dd664422dd664400707000339a7a33333bbb3333333333333333330000000000000000000000000ccd77d011111111dd111176 +2442244442244224422d666422ddd66422dd6644000e00003399a93333333b33333333333bb33b330000000000000000000000000cccddd01221122111111111 +22442244442244444442262422dddd6422dddd4400737000333993333b333333333333333bb333330000000000000000000000000cdccdd022882288111cc111 +4224422444422444444422442222224442222244000b00003333333333333333333333333333333300000000000000000000000000c2cc0022e822e8cccccccc +4444444444444444444444444444444444444444000b000033333333333333333333333333333333000000000000000000000000000cc000212e212ec55ddddc +d777777760066006c1dddd66c1dddd77cccccccc0099970000bbbbbbbbbbbb003333333300333300000000000000000067766666cccccccc1281128155d6667d +2eeeeeef00000000c1555566c1555567cc1111cca994497a0bbbbbbbbbbbbbb033333333033333300000000000000000d6766666cccccccc22882288dd666676 +2eeaeeef00000000c1555576c15555661155551109a00490bb333333333333bb33333333333333330000000000000000dd666666cccccccc22e822e8dd666676 +2aaaaaef00000000c1515576c15555661155551da49aa99ab33333333333333b3333333333333b33000000000000000066667776cc0cc0cc212e212edd666676 +2eaaaeef00000000c15d1176c1555566115555dd004999003333bb333333333333133133333333330000000000000000666d6676cccccccc12811281dd111176 +2eaeaeef00000000c155d166c1555566115555d6000440003333bb3333bb3333313113133b3333330000000000000000666d6676ccc00ccc22882288d1111116 +2eeeeeef00000000c1555566c155556611555566000000003333333333bb333313111131333333330000000000000000666ddd660c0000c022e822e8111cc111 +2222222d00000000c1111116c1111116111111dd0000000033333333333333331111111133333333000000000000000066666666c000000c211e211e11cccc11 +00666600000000000000000000000000000bb00000000000000000000000000000000000000000000f000f000f000f0000000000113311311133333333333333 +0600006000f0800000000000000ef000000b3b000000000000000000000000000f000f000f000f000ffffff00ffffff00f000f00011331100113333333333311 +6009800600000090be82887700ed7f00000b03000000000000007000000000000ffffff00ffffff00f1fff100f1fff100ffffff0001011000133133333333100 +60a77f060e077000be8828eb0edef7f0000308870007700000070700000700000f1fff100f1fff100effffe00effffe00f1fff10000001101111113333333310 +60b77e06000770a0bfe88efb0f7fede0088708880007700000007000000070000effffe00effffe000222000002220000effffe0000000000000133133131131 +600cd0060d0000000bfeefb000f7de0008880088000000000000000000000000002220000022200000888f000f88800000222000000000000011011131113000 +06000060000c0b0000bbbb00000fe000008800000000000000000000000000000088800000888f000f00000000000f000f888000000000000110011111001100 +006666000000000000000000000000000000000000000000000000000000000000f0f00000f0000000000000000000000000f000000000000000110000100110 +0777008000000000000000000077ee0000baa70000000000000000000000000007e007e007e007e007e007e007e007e007e007e00080000000000000008fff00 +00077687000000000077ee000eeeeee00bbab77000000000000000000000070007e007e007e007e007e007e007e007e007e007e0000fff000008fff0000f1f00 +00072777022222200eeeeee00eeeeff00aaabba00007000000700700070000000777777007777770077777700777777007777770000f1f000900f1f0000fffa0 +0707877702222220eeeeeffe0eeeeff0aabaaaaa0000070000000000000000000717771007177710071777100717771007177710000fffa00490fffa00992000 +0077777707888870eeeeeffe0eeeeee0999999990070000000000000000000000777777007777770077777700777777007777770090990000449990009999400 +0006675700777700888888880888888000088000000070000070070000000070008828000088280000882800008828000088280000a999000049990000aa9440 +006006770000000000222200002222000008e00000000000000000000070000008822280008227000882227007822280007822800aa9990000099000002a0040 +000000660000000000eeee0000eeee00000ee0000000000000000000000000000070070000700000070000000000007000000700000200000002000000000000 +000000000000bb3b00000000000000000000000000000000000000000000000000000000000000066666dddd0000000000000000666666660000011001100000 +00000000000bb2b200000000000aa000000000000000000000000000000000000000000000000066d666ddddd000000000000000666666660111007777111000 +00000000007bbbbb0000bb3b0099970000000000000000000000000000000000000070000000066ddd6d66dddd000000000a0000d66666dd0011177ff7770000 +0000bb3b07bb3300000bb2b20994497000000000000000000000000000000000000777000000666ddd66666ddd0000000aaaaa00dd6666dd000177fff7ff7110 +0bbbb2b20bb330b00b7bbbbb49a0049a00000000000000000000000000000000000070000006666dddd666ddddd0000000aaa000dddd6ddd017777fffffff711 +b77bbbbbbb330000b7bb2288049aa9900000000000000000000000000000000000000000006666ddddd6dddddddd000000a0a000dddddddd0777777fffff7710 +bbbb33000b0b0000bbbb3330004999000000000000000000000000000000000000000000066d6dddddddddddddddd00000000000dddddddd17fff77fffff7770 +3300b0bbb0b000003300b0bb00044000000000000000000000000000000000000000000066d66dddddddddddddddddd000000000dddddddd77ffffffffffff77 +00008ee0000ee00000e80000000e80000767676700766670000767000067676000000006666666666666ddddddddddddd0000000ddddddd6ffffffff00000000 +000080000000800000008000000080000000500000005000000050000000500000000066666666666666dddddddddddddd000000ddddddd6ffffffff00000000 +00777700007777000077770000777700007777000077770000777700007777000000006666666666666dddddddddddddddd00000dddddd66ffffffff00000000 +07777770077777700777777007777770077777700777777007777770077777700000666666666666666ddddddddddddddddd0000ddddd666ffffffff00000000 +07177710071777100717771007177710071777100717771007177710071777100006666666666666666dddddddddddddddddd000ddddd666ffffffff00000000 +077777700777777007777770077777700777777007777770077777700777777000666d666666666666dddddddddddddddddddd00dddddd66ffffffff00000000 +099999900999999777999997779999900eeeeee00eeeeee00eeeeee00eeeeee00666d666666666666dddddddddddddddddddddd0dddddd66ffffffff00000000 +077007707700000000000000000000770a00a000a000a000a00a00000a0a00006d666666666666666dddddddddddddddddddddddddddddd6ffffffff00000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000d200000000000000d50000000000000000d2000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000300000000000000000000000000000000000000000000f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2f2000000000000000000000000d20000000000 +00000000000000000000000000000000000000000000000000000000000000050000000034000000000000000000000000000000000000003400000000000000 +00000000000000000000000000000000000000000000000000000000f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3000000000000000000000000d13400000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0b0000000000000000000000000e0e0e0e0e0e0 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000a0a0d3a0a0a0a0a0d3a0a0a0a0a0d3a0b0d0000000000000000000000000f1f0f0f0f0f0 +0000000000000000000000000000000000000000000000000000000000000000000000e0e0e00000000000000000000000000000000000e0e0e0000000000000 +00000000000000000000000000000000000000000000000000000000a0b000a0a0a0a0b000a0a0a0a0b000b0d0d005000000000000000000000000f1f0f0f0f0 +0000000000000000000000000000000000000000000000000000000000000000000000f1f0e1000000000000000000000000e0e0000000f1f0e1000000e0e000 +00000000000000000000000000000000000000000000000000000000b0d000a0a0a0b0d000a0a0a0b0d000d0d0d00000000000000000000000000000f1f0f0f0 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000d0d0c0a0a0b0d0d0c0a0a0b0d0d0d0d0d0d0000000000000000000000000000000a0a0a0 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0e00000000000000000000000000000000000 +0000e0e0000000000000000000000000000000000000000000000000d0c0a0a0b0d0d0c0a0a0b0d0d0d0d0d0d0d0000000000000000000000000000000a0a0a0 +52000000000000000000000000000000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e00000000000000000000000a0a0a0 +93810000000000000000000000000000000000000000000000000000000000f0f0f0f0f0f0f0f0f0f0f000000000000000000000000000000000000000000000 +000000000000000000000000000000000000d2000000000000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0e1d100000000000000000000000000a0a0a0 +828293000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0e0e000f1f0f0f0e100f1f0f0f0e100000000000000000000000000000000000000000000 +000000000000000000000000000000000000d1000000e0e0e0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f000d100000000000000000000000000a014a0 +848383000036000000000000000000f0c3f0f0f0f0f0f0f0f0f0f0f0f0f00000f0f0f0000000f0f0f00000000000000000000000000000003600000000000000 +000000000000000000000000000000000000d1000000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f000d10000000000000000d200000000a0a0a0 +e0e0e0e0e0e0000000000000000000f0f0e10000f1f0c3e10000f1f0f0e10000f0f0f0000000f0f0f0000000003400340000000000000000e000000000000000 +000000000000000034003400000000000000e0e0e0e0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f1f0e100d10000000000000000d1000000e0e0e0e0 +f0f0c3f0f0f0000000000000000000c3f000000000f0f000000000f0f0000000f0f0f0000000f0f0f0000000e0e0e0e0e000000000000000f000000000000000 +00000000000000e0e0e0e0e0000000000000f0e100f1f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f000d10000d10000000000000000e0e0e0e0f0f0f0f0 +c3f0f0f0f0f0000000000000000000f0f000000000f0f000000000f0f0000000f0f0f0000000f0f0f0000000f1f0f0f0e100000000000000f000000000000000 +00000000000000f1f0f0f0e1000000000000d1000000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f000d10000d10000000000000000f1f0f0f0f0f0f0f0 +0000000000000000000000000000000000000000000000000000000000000000e48282828282828282828282828282f400000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000e482828282828282828282f4e4f40000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000d4d4e4f4d4e48282f4d40000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000e4f400000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +84000000000000000000000000910000000000000000000000240000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +13131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131300000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000820000000000828200000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000820000000000828200000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000e6f6000000000000000000000000000000000000820000000000828200000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000096b60000000000000000e6f6e6e7e7f60000000000000000000000000000520000825200715200828200000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000096c7000087a7b7b696b6000087b6e6e7e7e7e7e7e7f6e6f60000e6f6000000000000524100008241009341e6828200000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +b687a7b7b68797a7b7b7a6b7b696d6b7e7e7e7e7e7e7e7e7e7e7f6e6e7e7f6e671000000419371e68293f6828282828200000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +d797a7b7b7d6d6b7b7b7b7b7b7d6b7b7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e79393f6e693829382828282728282828200000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +b7d6b7b7b7b7b7b7b7b7b7b7b7b7b7b7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e7e76282828282728282828282828282828200000000000000000000000000000000 +__label__ +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccfeccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +ccf7decccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cf7fedeccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cedef7fccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cced7fccccccccccccccccccccccccccccc7777ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccefccccccccccccccccccccccccccccc7777777ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccc777777777cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc777777777777ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb777777777777ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +333333333333333333333333333333bb777777777777cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +3333333333333333333333333333333b7777777777777ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +3bb33b333bb33b333bb33b33333333337777777777777cccccccccccccccccc6cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +3bb333333bb333333bb3333333bb3333777777777777777ccccccccccccccc66dccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +33333333333333333333333333bb333377777777777777777cccccccccccc66dddcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +33333333333333333333333333333333777777777777777777cccccccccc666dddcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +333333333333333333333333333333337777777777777777777cccccccc6666ddddccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +333333333333b333333333333333b3337777777777777777777ccccccc6666ddddddcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +333333333333bab33339a3333333bab377777777777777777777ccccc66d6ddddddddccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +33333333333bbb33339a7a33333bbb33777777777777777777777ccc66d66ddddddddddccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +3333333333333b333399a93333333b33777777777777777777777cc66666ddddddddddddccccccccccccccc6ccccccccccccccccccccccccccccccc6cccccccc +333333333b333333333993333b3333337777777777777777777777666666dddddddddddddccccccccccccc66dcccccccccc7777ccccccccccccccc66dccccccc +33333333333333333333333333333333777777777777777777777766666dddddddddddddddccccccccccc66dddcccccccc7777777ccccccccccccc66ddcccccc +33333333333333333333333333333333777777777777777777776666666dddddddddddddddcccccccccc666dddccccccc777777777cccccccccc6666ddcccccc +33333333333333333333333333333333777777777777777777766666666ddddddddddddddddcccccccc6666ddddcccc777777777777cccccccc66666dddcccc7 +33333333333333333333b33333333333777777777777777777666d6666ddddddddddddddddddcccccc6666ddddddcc7777777777777ccccccc666d66ddddcc77 +33333333333333333333bab33333333377777777777777777666d6666ddddddddddddddddddddcccc66d6ddddddddc77777777777777ccccc666d666dddddc77 +3333333333333333333bbb333333333377777777777777776d6666666ddddddddddddddddddddddc66d66dddddddddd77777777777777ccc6d666666ddddddd7 +333333333333333333333b33333333337777777777777776666666666666dddddddddddddddddddd6666dddddddddddd7777777777777cc666666666dddddddd +33333333333333333b33333333333333d777777777777766666666666666ddddddddddddddddddddd666ddddddddddddd77777777777776666666666dddddddd +33333333333333333333333333333333dd7777777777776666666666666ddddddddddddddddddddddd6d66dddddddddddd7777777777766dd66666dddddddddd +33333333333333333333333333333333dd7777777777666666666666666ddddddddddddddddddddddd66666ddddddddddd7777777777666ddd6666dddddddddd +33333333333333333333333333333333ddd777777776666666666666666dddddddddddddddddddddddd666ddddddddddddd777777776666ddddd6ddddddddddd +3333b333333333333333b33333333333dddd777777666d666666666666ddddddddddddddddddddddddd6dddddddddddddddd7777776666dddddddddddddddddd +3333bab3333333333333bab33339a333ddddd7777666d666666666666dddddddddddddddddddddddddddddddddddddddddddd777766d6ddddddddddddddddddd +333bbb3333333333333bbb33339a7a33ddddddd76d666666666666666dddddddddddddddddddddddddddddddddddddddddddddd766d66ddddddddddddddddddd +33333b333333333333333b333399a933dddddddd6666666666666666dddddddddddddddddddddddddddddddddddddddddddddddd66666666dddddddddddddddd +3b333333333333333b33333333399333dddddddd6666666666666666dddddddddddddddddddddddddddddddddddddddddddddddd66666666dddddddddddddddd +33333333333333333333333333333333ddddddddd66666ddd66666ddddddddddddddddddddddddddddddddddddddddddddddddddd66666dddddddddddddddddd +33333333333333333333333333333333dddddddddd6666dddd6666dddddddddddddddddddddddddddddddddddddddddddddddddddd6666dddddddddddddddddd +33333333333333333333333333333333dddddddddddd6ddddddd6ddddddddddddddddddddddddddddddddddddddddddddddddddddddd6ddddddddddddddddddd +3333333333333333333333333333b333dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +3333333333333333333333333333bab3dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +333333333333333333333333333bbb33dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +33333333333333333333333333333b33dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +3333333333333333333333333b333333dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +33333333333333333333333333333333dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +33333333333333333333333333333333dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +33333333333333333333333333333333dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +33333333333333333333333333333333dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +33333333333333333333333333333333dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +33333333333333333333333333333333dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +33133133331331333313313333133133dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +31311313313113133131131331311313dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +13111131131111311311113113111131dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +11111111111111111111111111111111dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd +1d1d12224444d4d4ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd7777777dddddddd +111d12224444d444dddddddddddddddddddddddddfdddfdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd2eeeeeefdddddddd +d1dd1124444424dddddbdddddddddddddddddddddffffffddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd2eeeeeefdddddddd +d1111222444424dddddbdddddd7d7ddddddddddddf1fff1ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd2eeeeeefdddddddd +dddd12224444ddddbddbdddddddedddddddddddddeffffedddddddddddddddddddddddddddddddddddddddddddddddddddd7dddddddddddd2eeeeeefdddddddd +dddd112444444ddddbdbddbddd737ddddddddddddd222ddddddddddddddddddddddddddddddddddddddddddddddddddddd7a7ddddddddddd2eeeeeefdddddddd +ddd12222244444dddbdbdbdddddbdddddddddddddd888dddddddddddddddddddddddddddddddddddddddddddddddddddddd7dddddddddddd2eeeeeefdddddddd +dd1111122444444ddbdbdbdddddbddddddddddddddfdfdddddddddddddddddddddddddddddddddddddddddddddddddddddd3dddddddddddd2222222ddddddddd +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333222333332223333322233333222333332223333322233333222333332223333322233333222333332223333322233333222333332223333322233333222 +23332222233322222333222223332222233322222333222223332222233322222333222223332222233322222333222223332222233322222333222223332222 +22224442222244422222444222224442222244422222444222224442222244422222444222224442222244422222444222224442222244422222444222224442 +22244444222444442224444422244444222444442224444422244444222444442224444422244444222444442224444422244444222444442224444422244444 +44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 +22442244444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 +42244224444444444444444444444444444444444442244444444444444444444444444444444444444444444444444444444444444444444464444444444444 +44224424444444444444444444444444444444444444224444444444444444444444444444444444444444444444444444444444444444444666d44444444444 +2442244444444444444444444444444444444444422442244444444444444444444444444444444444444444444444444444444444444444422d666444444444 +22442244444444444444444444444444444444444422444444444444444444444444444444444444444444444444444444444444444444444442262444444444 +42244224444444444444444444444444444444444442244444444444444444444444444444444444444444444444444444444444444444444444224444444444 +44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 +44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 +44444444446644442244224444444444224422442244224422442244444444444444444444444444224422442244224444444444444444444444444444444444 +4444444442d674444224422444444444422442244224422442244224444444444444444444444444422442244224422444422444444444444444444444444444 +4444444422dd66444422442444444444442244244422442444224424444444444444444444444444442244244422442444442244444444444444444444444444 +4444444422ddd6642442244444444444244224442442244424422444444444444444444444444444244224442442244442244224444444444444444444444444 +4444444422dddd642244224444444444224422442244224422442244444444444444444444444444224422442244224444224444444444444444444444444444 +44444444222222444224422444444444422442244224422442244224444444444444444444444444422442244224422444422444444444444444444444444444 +44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 + +__gff__ +0002020200001202020200000000020202020000000002010000020200000000020202020200000000420000000002021242020202024242000000000200020260706060700000000000000000000000200220006000000004040c0c04200000a0000060a0a0a0a00000000000000000a0000808b00000000000000000000002 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__map__ +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d09000900090009430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002828 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000909070809090909090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000392828 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000090a0a0a0a0a0a0a0a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018282828 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090a0a0a440a0a0a0b0000000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000043003928282828 +43000000000000000000000000000000000000000000000000000036292929293700000000003629293700000000000000000000000005000000000000000009700a440a440a0b0d0000000000000000430000000000000000000000000000000000000000000000443044000000000000000000000000700000002828282828 +292929370000000000000000000000000000000000000000000000282728272627000000000027282627000000000000000025170000140000000000000000090a0a0a440a0b0d0d0000000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000018002728282828 +282726270000000000000000000000000000000000000000000000272628282728000006000027282728000000740000000003030303030000000000000000090a0a0a0a0b0d0d0d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000027392828412828 +282828280000000000000000000000000000000000430000000000282827282726000000000028272827000000000000391802210202023939180000000000090a0a0a0b0d0d0c090000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000014180027282828282826 +282827280000000000000000000000000000000630060000000000262828282827000000000038383838003918391839282802020224022828283939180000090708090907080909170000050000000000000000000000000000000000000000000000000000140000000000000000000000000000003928002828380e0e0e38 +2728272600000000000000000000000000000006060600000000003838383838380000000000001213703938063038382828202020202028282728282818000303030303030303030300391400000000000000000000000000000000000000000500000000001405000000000000000004000000251828281803030303030303 +2828282700000000000000000000000000000000000000000000000000121300000070000003030303030303030303032828282828282827282728282828392002232020202002200239273900000000000000000000000630000000000005001405000000051414000000000000000014180000142828282802020202020202 +3838383800000000000000000000000000000500000000000000030303030303030303030302020202020202020202022828282828282728272828282828280606062828282828282827282818030303030300000070000606000000050014001414000000141414000000000000000039270000392827280602202002022002 +1213172500480000000000000400060000001425000000700017020220200202020202020202022002020202202302023838383838383838383838383838380606063870387038703870383838020202020203030303030303007000140414001414000404141414005200000000001738383917383838300602022002240202 +0303030303030303030303030303030303030303030303030303020202020202020202020202022320020220200202020303030303030303030303030303030303030303030303030303030303020202020202022002020202030303030303030303030303030303030303030303030303030303030303030302022320020202 +2002020202210202020202020202220202020202020220200221020202022002200202230202020202020202200202020220020202020202020202020202020202020202020202020202020202200202200202020202230202020202020202022002020223020202020202022002020202022002022020200202020202202002 +0223200220202002020220202102020202200202020202202002020202020202202002022120022102020202022420020202020202020202020202202002022002020220200220200202202020022002200202020202020202022302020202200202020202020202020202230202020202020202020202200202020220200202 +0000000000000000000000000000000000000000000000000000000000001400140000000000000000140014000014000014140000140014000014000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000001400140000000000000000140014000014000014140000140014000014000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000001400140000000000000000000014000014000014140000140014000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000140000000000000000000014000014000014140000140014000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000014000014140000140014000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000014140000000014000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +2805000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +2739180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +4828270017170400000000190000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +292929292929291a1a1a29292900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0101010101010104000001010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202200214050002020200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +2002202002020214140002020200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__sfx__ +000300000c540105301f540135301856016550135401353018560105501f54010530135601655013540135301a520105401f530105201a510135201f510165001a50013500135001a50010500215001050013505 +01100000240452400528000280452b0450c005280450000529042240162d04500005307553c5252d000130052b0451f006260352b026260420c0052404500005230450c00521045230461f0450c0051c0421c025 +01100000187451a7001c7001c7451d745187001c7451f7001a745247001d7451d70021745277002470023745217451f7001d7001d7451a7451b7001c7451f7001a745227001c7451b70018745187001f7451f700 +01100000305453c52500600006003e625006000c30318600355250050000600006003e625006000060018600295263251529515006003e625006000060018600305250050018600006003e625246040060000600 +01100000004000c40018400004000a400004000a4000c400004000a4000c400004000a4000c4001140013400004000c4000a400004000a400004000a4000c400004000c40016400004001640018400114000c400 +01100000270752607724075200721f0751b0771a0751b075180721806218052180421803500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +011000000c30018300243001f3001b3001a300193001b300183001830017300163001530014300133001830014300143001830018300003000030000300003000030000300003000030000300003000030000300 +011000000c37300300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300003000030000300 +000000001e0701f070220702a020340103f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000100002b7602e7503a73033740377302e75033730337303372035710377103a710337103a7103c7103c7003f700007000070000700007000070000700007000070000700007000070000700007000070000700 +000200002965021630136301e63012620126301322017630176300b6301361012110116100d1100a6100a61008610106000d60004600116000e6001160012600116000a600066000960003600026000260002600 +000100002257524575275652455527555275552b54524525225352252527525275252b5252e515305152e515305052e505305052e5053050530505335052b5052e5052b5052e5052e5053350530505335052e505 +000200002005325043160231002304013030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0102000013571165731b5751d5711157313575165711b5731b575225711b573185751b5711f573245751b5711f57324565295611f563185611d555245532b5552b5412b5433053137535335333a5212b5252e513 +000100002b571275711b57118571105710b57106571045710457106561035510454103531015210153105531035210a5210f5200c5200f72016510167101d5101d510245102b5100050000500005000050000500 +010200002e17029170171731a171231631d16111143141610c1230a11107110001000010000100001000010000100001000010000100001000010000100001000010000100001000010000100001000010000100 +01040000185702257024570225701f5701d5701f5701d57018570165701857016570135701157013570115700c5700d570135701457018560195501f550205302453024520225202452022510245102251024500 +00030000281602a1502c14029440220301f030220301b0201d0201d020160200f02013020130100c010110100f5100a5100a5100c5100c51007510075100a5100501003010375003b7003050034700375003b700 +000200001557015570165701657017560185401a5401c5301f5202251029510005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500 +000200001f07018060110400e0300c020160201602016010180101b01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +011c00000c7550070013755007001175500700007000070013755007001475513755117550070000700007000d755007000070011755137550070011755007000d75500700117550d75513755007001175500700 +000200001c17023170201701317012170161600d0600c0500b0400b0400c0300a0200802007010060100400003000020000100001000000000000000000000000000000000000000000000000000000000000000 +000100001057015510195701c51021570235202350000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500 +010100001b07017020190701a0101f0301e0102506021000260001e03027000210000e000210300e0000e0000e000270100e0000e0000e0000e0000e0000e0000e0000e0000e0000e0000e0000e0000e0000e000 +01080000185461c5361f526215161f54621536245262851624546285362b5262f5162b5463053634526375161f50024500285002b5001f50024500285002b5000000000000000000000000000000000000000000 +00020000125501455017550195501c550235502a55000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000023570215701f5601d5501b540115400f5300d5100a1100c1100d1100f1101351000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500 +00020000251602215020160181501d1301b1501b5401f5301f520183101b5301f5301b53016530185201652011520165201651013510115100f5100c5100c5100a51007510075100551000500005000050000500 +01020000395503b5513b5213b51100500005000050000500005000050000500005003b5503d5513f5513f5203f500375003050037500305003750030500005003f51037530305313753130521375213051100500 +0106000014472154411b4712347127566157610e5560b1410b5412a23632531385223f5213f426225111921115516155111651218411195161b5111c5161f1112041619311107110f5160f211101111241100701 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +011c00000c7550070013755007001175500700007000070013755007001475513755117550070000700007000d755007000070011755137550070011755007000d75500700117550d75513755007001175500700 +011c00000c7550070011755007001375500700007000070018755007001475518755137550070011755007000d755007000070011755137550070011755007000d75500700117550d75511755007001375500700 +011c000018024180201d0311d0351f0321f0311f0221f012200322002124035200321f0321f0351d0311d03519030190301d0321d032190311903219025180321603216032180351d03519032190321803216032 +011c000018024180201d0311d0251f0321f0321f0221f015200322002124032200351f0321f0321d0311d0351952019520195251d522195321953218532185321952219115195251d51519522185221952216512 +011c0000180061d0061f72622716180061d1161f11622006180001d0001f00022000180061d1161f11622006190061d0061f72622716190061d1161f11622006190061d0061f72622716190061d1161f11622006 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0110000000145000450c0050c0050c6450000000145000450000000000011450c0001862500000000000000500145000450c0050c0050c645000000014500045011050110518625011451860524615011450c145 +01180000187461b7361f72622716187461b7361f726227160070000700007000070000700007000070000700197461d7362072624716197461d73620726247160070000700007000070000700007000070000700 +01100000187251a7251b7251f725187251a7251b7251f7251a7251b7251f725227251a7251b7251f72524725197251d7251f72522725197251d7251f72522725197251d7251f72522725197251d7251f72522725 +0110000024525295252450524515295152b52500000000000000000000000000000020525225262453527525295222b5222e522295262952529525275252750527525255252050525525245251f5052452522525 +011000002450522525245251f525000001f5251d525185250000020505000002250522525245052953524505295022b5052e5051d525295251f5252b5250000027525255252050525525295251f505295252b525 +__music__ +01 01434144 +00 02434144 +00 01034244 +02 02034244 +01 20644144 +00 21634144 +00 20644144 +00 21634144 +00 20244144 +00 21244144 +00 20226444 +00 21236444 +00 20222444 +00 21232444 +00 20244144 +02 21244144 +01 28696a6b +00 28696a6b +00 28692a6b +00 28692a6c +00 28692a2b +00 28692a2c +00 28692a6b +02 28692a2c +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 +00 41414144 + diff --git a/demos/sort.p8 b/demos/sort.p8 new file mode 100644 index 0000000..a900645 --- /dev/null +++ b/demos/sort.p8 @@ -0,0 +1,243 @@ +pico-8 cartridge // http://www.pico-8.com +version 23 +__lua__ +-- sorting demo +-- by zep + +-- starting giraffee heights +g = {3,5,7,2,9,1,2} + +-- draw a giraffe at x,y with +-- neck length of l +function draw_giraffe(x,y,l) + + -- body + spr(33,x-8,y-8,2,1) + + -- neck for l segments + for i=1,l do + spr(18, x,y-8-i*8) + end + + -- put head on top + spr(2, x,y-16-l*8) + +end + +function _draw() + cls(12) + rectfill(0,110,127,127,14) + + print("press 🅾️ to randomize", + 22, 2, 7) + print("press ❎ to sort", + 32, 10, 7) + + for i=1,7 do + draw_giraffe(i*16,110,g[i]) + end + +end + +function _update() + + -- ❎ to sort + + if (btnp(5)) then + + -- look for a pair of + -- giraffees out of order + + for i=1,6 do + + if (g[i] > g[i+1]) then + + -- the left one is taller, + -- so swap them! + temp = g[i] + g[i] = g[i+1] + g[i+1] = temp + + sfx(0) + + -- just one swap for now! + break + + end + end + + end + + + -- 🅾️ to randomize + + if (btnp(4)) then + + for i=1,7 do + g[i]=flr(rnd(9)) + end + + sfx(1) + + end + + +end +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000900900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000a00a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000aaaaa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000aa1aaaa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000aaaaaaa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000aaa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000aaa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000a9900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000a9900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000aa900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000aaa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000009aa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000009aa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000aaa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000aa9900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000aaa999aa9900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000006aaaa99aaaaa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000006099aaaaaaaaa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000099aaaaa99aa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000009040000900400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000a040000a00400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000a040000a00400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__label__ +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccc777c777c777cc77cc77cccccc77777cccccc777cc77ccccc777c777c77cc77ccc77c777c777c777c777ccccccccccccccccccccccc +cccccccccccccccccccccc7c7c7c7c7ccc7ccc7ccccccc77ccc77cccccc7cc7c7ccccc7c7c7c7c7c7c7c7c7c7c777cc7cccc7c7ccccccccccccccccccccccccc +cccccccccccccccccccccc777c77cc77cc777c777ccccc77c7c77cccccc7cc7c7ccccc77cc777c7c7c7c7c7c7c7c7cc7ccc7cc77cccccccccccccccccccccccc +cccccccccccccccccccccc7ccc7c7c7ccccc7ccc7ccccc77ccc77cccccc7cc7c7ccccc7c7c7c7c7c7c7c7c7c7c7c7cc7cc7ccc7ccccccccccccccccccccccccc +cccccccccccccccccccccc7ccc7c7c777c77cc77ccccccc77777ccccccc7cc77cccccc7c7c7c7c7c7c777c77cc7c7c777c777c777ccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccc777c777c777cc77cc77cccccc77777cccccc777cc77cccccc77cc77c777c777ccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccc7c7c7c7c7ccc7ccc7ccccccc77c7c77cccccc7cc7c7ccccc7ccc7c7c7c7cc7cccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccc777c77cc77cc777c777ccccc777c777cccccc7cc7c7ccccc777c7c7c77ccc7cccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccc7ccc7c7c7ccccc7ccc7ccccc77c7c77cccccc7cc7c7ccccccc7c7c7c7c7cc7cccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccc7ccc7c7c777c77cc77ccccccc77777ccccccc7cc77cccccc77cc77cc7c7cc7cccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc9cc9ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaccaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaaacccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaa1aaaacccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaaaaacccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaa9ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccc9cc9ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccaccacccccccccccccccccccccccccccccaa9ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccaaaaaccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccaa1aaaacccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccaaaaaaacccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccaa9cccccccccccccccccccccccccccccaa9ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccccccccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccc9cc9ccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccaccacccccccccccccaa9cccccccccccccccccccccccccccccaa9ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccaaaaaccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccaa1aaaacccccccccc9aaccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccaaaaaaacccccccccc9aaccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccca99ccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccca99ccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccaa9cccccccccccccaa9cccccccccccccccccccccccccccccaa9ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccc9aaccccccccccccc9aaccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccc9aaccccccccccccc9aaccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccccccccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccccccccccccccccccca99ccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccc9cc9ccccccccccccca99ccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccaccacccccccccccccaa9cccccccccccccaa9cccccccccccccccccccccccccccccaa9ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccaaaaaccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccaa1aaaacccccccccc9aaccccccccccccc9aaccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccaaaaaaacccccccccc9aaccccccccccccc9aaccccccccccccccccccccccccccccc9aaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccccccccccccccccccccccccccccccccccc +cccccccccccccccccca99ccccccccccccca99ccccccccccccca99cccccccccccc9cc9ccccccccccccca99cccccccccccccccccccccccccccc9cc9ccccccccccc +ccccccccccccccccccaa9cccccccccccccaa9cccccccccccccaa9ccccccccccccaccacccccccccccccaa9ccccccccccccccccccccccccccccaccaccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaaccccccccccccaaaaaccccccccccccaaaccccccccccccccccccccccccccccaaaaacccccccccc +cccccccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccaa1aaaacccccccccc9aaccccccccccccccccccccccccccccaa1aaaacccccccc +cccccccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccaaaaaaacccccccccc9aaccccccccccccccccccccccccccccaaaaaaacccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccccccccccccccccccaaaccccccccccc +cccccccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccccccccccccccccccca99ccccccccccc +cccccccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99cccccccccccc9cc9ccccccccccccca99ccccccccccc +ccccccccccccccccccaa9cccccccccccccaa9cccccccccccccaa9cccccccccccccaa9cccccccccccccaa9ccccccccccccaccacccccccccccccaa9ccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaaccccccccccccaaaaaccccccccccccaaaccccccccccc +cccccccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccaa1aaaacccccccccc9aaccccccccccc +cccccccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccaaaaaaacccccccccc9aaccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaaccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaaccccccccccc +cccccccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccc +cccccccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccccca99ccccccccccc +ccccccccccccccccccaa9cccccccccccccaa9cccccccccccccaa9cccccccccccccaa9cccccccccccccaa9cccccccccccccaa9cccccccccccccaa9ccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaaccccccccccc +cccccccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccc +cccccccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccccc9aaccccccccccc +ccccccccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaacccccccccccccaaaccccccccccc +cccccccccccccccccaa99ccccccccccccaa99ccccccccccccaa99ccccccccccccaa99ccccccccccccaa99ccccccccccccaa99ccccccccccccaa99ccccccccccc +cccccccccccaaa999aa99ccccccaaa999aa99ccccccaaa999aa99ccccccaaa999aa99ccccccaaa999aa99ccccccaaa999aa99ccccccaaa999aa99ccccccccccc +ccccccccc6aaaa99aaaaacccc6aaaa99aaaaacccc6aaaa99aaaaacccc6aaaa99aaaaacccc6aaaa99aaaaacccc6aaaa99aaaaacccc6aaaa99aaaaaccccccccccc +cccccccc6c99aaaaaaaaaccc6c99aaaaaaaaaccc6c99aaaaaaaaaccc6c99aaaaaaaaaccc6c99aaaaaaaaaccc6c99aaaaaaaaaccc6c99aaaaaaaaaccccccccccc +cccccccccc99aaaaa99aaccccc99aaaaa99aaccccc99aaaaa99aaccccc99aaaaa99aaccccc99aaaaa99aaccccc99aaaaa99aaccccc99aaaaa99aaccccccccccc +cccccccccc9c4cccc9cc4ccccc9c4cccc9cc4ccccc9c4cccc9cc4ccccc9c4cccc9cc4ccccc9c4cccc9cc4ccccc9c4cccc9cc4ccccc9c4cccc9cc4ccccccccccc +ccccccccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4ccccccccccc +ccccccccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4cccccac4ccccacc4ccccccccccc +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + +__sfx__ +0001000022050280502f0500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000200001b5501d5501b5501b5501b540165301d5301d520005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500 diff --git a/demos/wander.p8 b/demos/wander.p8 new file mode 100644 index 0000000..0f6b02a --- /dev/null +++ b/demos/wander.p8 @@ -0,0 +1,255 @@ +pico-8 cartridge // http://www.pico-8.com +version 19 +__lua__ +-- wander demo +-- by zep + +x=24 y=24 -- position (in tiles) +dx=0 dy=0 -- velocity +f=0 -- frame number +d=1 -- direction (-1, 1) + +function _draw() + cls(1) + + -- move camera to current room + room_x = flr(x/16) + room_y = flr(y/16) + camera(room_x*128,room_y*128) + + -- draw the whole map (128⁙32) + map() + + -- draw the player + spr(1+f, -- frame index + x*8-4,y*8-4, -- x,y (pixels) + 1,1,d==-1 -- w,h, flip + ) +end + +function _update() + + ac=0.1 -- acceleration + + if (btn(⬅️)) dx-= ac d=-1 + if (btn(➡️)) dx+= ac d= 1 + if (btn(⬆️)) dy-= ac + if (btn(⬇️)) dy+= ac + + -- move (add velocity) + x+=dx y+=dy + + -- friction (lower for more) + dx *=.7 + dy *=.7 + + -- advance animation according + -- to speed (or reset when + -- standing almost still) + spd=sqrt(dx*dx+dy*dy) + f= (f+spd*2) % 4 -- 4 frames + if (spd < 0.05) f=0 + + -- collect apple + if (mget(x,y)==10) then + mset(x,y,14) + sfx(0) + end + +end + +__gfx__ +0000000000000000000000000007000700070007000000000000000000000000000000000000000033333b333333333333333333339933333333333333333333 +000000000007000700070007000777770007777700000000000000000000000000000000000000003333b33333b3333333333333339a39933333333333b33333 +007007000007777700077777700717717007177100000000000000000000000000000000000000003388b8833b333b333333b33333377a93333333333b333b33 +000770007007177170071771700777e7700777e70000000000000000000000000000000000000000388888783333b3333b33b33339a77333333333333333b333 +00077000700777e7700777e70776686007766860000000000000000000000000000000000000000038888888333b333b33b3b3b3399ba93333333333333b333b +0070070007766860077668600777777007777770000000000000000000000000000000000000000038e8888833b333b333b333b3333b99333333333333b333b3 +00000000077777700777777070d0070670d070600000000000000000000000000000000000000000338e888333333b3333333333333b33333333333333333b33 +00000000171d7160171d171601111100011111000000000000000000000000000000000000000000311888333333333333333333331b33333333333333333333 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000077007707700077007700770077000770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000e7007e0e77007e00e7007e00e70077e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000e7007e00e7007e00e7007e00e7007e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000077777700777777007777770077777700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000071771700717717007177170071771700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000007777000077770000777700007777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000007777000077777000777700077777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000070007000070000000700070000007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__label__ +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333b33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +3333333333333333333333333b333b33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +3333333333333333333333333333b333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +333333333333333333333333333b333b333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333b333b3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333b33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +3333333333333333333333333333333333333333333333333333333333b333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333b333333333333333333333333333333333333b333b333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333b33b333333333333333333333333333333333333333b3333333333333333333333333333333333333333333333333333333333333333333 +333333333333333333b3b3b333333333333333333333333333333333333b333b3333333333333333333333333333333333333333333333333333333333333333 +333333333333333333b333b33333333333333333333333333333333333b333b33333333333333333333333333333333333333333333333333333333333333333 +3333333333333333333333333333333333333333333333333333333333333b333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b333333333333333333333 +33333333333333333333333333333333333333333333b333333333333333333333333333333333333333333333333333333333333b333b333333333333333333 +33333333333333333333333333333333333333333b33b333333333333333333333333333333333333333333333333333333333333333b3333333333333333333 +333333333333333333333333333333333333333333b3b3b333333333333333333333333333333333333333333333333333333333333b333b3333333333333333 +333333333333333333333333333333333333333333b333b33333333333333333333333333333333333333333333333333333333333b333b33333333333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333333333333333b3333333333333333333333333333333333333333333333333333333333333 +3333333333333333333333333333b3333333b3333333333333333333333333333b333b3333333333333333333333333333333333333333333333333333333333 +3333333333333333333333333b33b3333b33b3333333333333333333333333333333b33333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333b3b3b333b3b3b3333333333333333333333333333b333b33333333333333333333333333333333333333333333333333333333 +33333333333333333333333333b333b333b333b333333333333333333333333333b333b333333333333333333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333333333333333333b3333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333339933333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333339a39933333333333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333377a933333333333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333339a773333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333399ba9333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b99333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b33333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333331b33333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +333333333333333333b3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333b333b3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333b33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +3333333333333333333b333b33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +333333333333333333b333b333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +333333333333333333333b3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333373337333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333377777333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333373371771333333333333333333333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333333333733777e7333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333337766863333333333333333333333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333333333377777733333333333333333333333333333333333333333b3333333333333333333 +333333333333333333333333333333333333333333333333333333333333171d71633333333333333333333333333333333333333b33b3333333333333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b3b3b33333333333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b333b33333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333399333333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333339a399333333333 +333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333377a9333333333 +333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333339a7733333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333399ba93333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b993333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b333333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333331b333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333339933333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333339a39933333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +3333333333377a933333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +3333333339a773333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333399ba9333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333b99333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333b33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333331b33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b3333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b333b3333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b33333333333 +3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b333b33333333 +333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b333b333333333 +333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b3333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +3333333333333333333333333333333333333333333333333333b3333333333333333333333333333333333333333333333333333333b3333333333333333333 +3333333333333333333333333333333333333333333333333b33b3333333333333333333333333333333333333333333333333333b33b3333333333333333333 +33333333333333333333333333333333333333333333333333b3b3b333333333333333333333333333333333333333333333333333b3b3b33333333333333333 +33333333333333333333333333333333333333333333333333b333b333333333333333333333333333333333333333333333333333b333b33333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333b3333333333333333333333333333333b333333333333333333333333333333333333333333333 +3333333333333333333333333333b33333333333333333333b333b333333333333333333333333333b333b3333333333333333333333b333333333333333b333 +3333333333333333333333333b33b33333333333333333333333b3333333333333333333333333333333b33333333333333333333b33b333333333333b33b333 +33333333333333333333333333b3b3b33333333333333333333b333b333333333333333333333333333b333b333333333333333333b3b3b33333333333b3b3b3 +33333333333333333333333333b333b3333333333333333333b333b333333333333333333333333333b333b3333333333333333333b333b33333333333b333b3 +33333333333333333333333333333333333333333333333333333b3333333333333333333333333333333b333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 +333333333333333333333333333333333333333333b33333333333333333333333333333333333333333333333333333333333333333333333b3333333333333 +33333333333333333333333333333333333333333b333b3333333333333333333333333333333333333333333333333333333333333333333b333b3333333333 +33333333333333333333333333333333333333333333b33333333333333333333333333333333333333333333333333333333333333333333333b33333333333 +3333333333333333333333333333333333333333333b333b3333333333333333333333333333333333333333333333333333333333333333333b333b33333333 +333333333333333333333333333333333333333333b333b3333333333333333333333333333333333333333333333333333333333333333333b333b333333333 +333333333333333333333333333333333333333333333b33333333333333333333333333333333333333333333333333333333333333333333333b3333333333 +33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + +__map__ +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0f0e0e0e0e0e0e0e0e0e0e0e0e0d0b0e0e0e0e0e0e0e0e0e0e0e0e0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0c0e0e0e0e0f0e0e0e0e0e0e0e0e0c0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0c0e0e0e0e0e0e0e0f0e0e0e0e0e0c0e0e0e0a0e0e0b0e0e0e0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0c0c0e0e0e0b0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0c0c0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0f0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0d0e0e0c0e0e0e0e0e0e0e0e0e0e0a0e0f0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0f0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0f0b0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0f0e0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0c0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0c0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0e0d0e0e0e0e0e0e0e0e0e0e0a0e0e0e0e0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0f0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0d0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0e0e0e0e0e0e0e0e0e0b0e0e0c0e0e0e0f0e0e0e0e0c0e0e0e0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0e0c0e0e0e0e0e0e0c0e0e0e0e0e0f0f0e0e0e0e0e0e0e0e0e0e0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0c0e0e0f0e0e0e0f0e0e0c0e0c0e0e0e0c0e0e0e0e0e0e0e0e0d0e0f0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000e0e0e0e0e0b0e0e0e0e0e0e0e0e0b0e0e0d0e0e0f0e0e0e0e0e0e0c0e0e0e0e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__sfx__ +000100001b5701f5701d5701f570225602755024542275422e532335223a52230502355023c5022b5022e5022e502335022e502305023a7023a7023a7023a7023a7023a7023a7023a7003a7003a7003b7003b700 +011000001805000000000001a0501c050000001f050000002105023050210501f0501c050000001f0501c050170500000000000180501c050000001f0500000022050210501f0501e0501f0501f0421f02200000 +010600000a3750f37513375183750f3750f47511475164751b47516475164751b4651d4651b4551b4551d445224451d4351d43524425274252441524415294052b40524405244052740529405274052440527405 +__music__ +03 01424344 + diff --git a/demos/waves.p8 b/demos/waves.p8 new file mode 100644 index 0000000..fdb303a --- /dev/null +++ b/demos/waves.p8 @@ -0,0 +1,156 @@ +pico-8 cartridge // http://www.pico-8.com +version 19 +__lua__ +-- waves demo +-- by zep + +r=64 + +function _draw() + cls() + for y=-r,r,3 do + for x=-r,r,2 do + local dist=sqrt(x*x+y*y) + z=cos(dist/40-t())*6 + pset(r+x,r+y-z,6) + end + end +end + +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__label__ +60606060600000000060000000006000000000000000000000000000000000000000000000000000000000000000000000006000000000600000000060606060 +00000000006000000000600000000060000000000000000000000000000000000000000000000000000000000000000000600000000060000000006000000000 +00000000000060000000006000000000606000000000000000000000000000000000000000000000000000000000006060000000006000000000600000000000 +60606000000000600000000060000000000060000000000000000000000000000000000000000000000000000000600000000000600000000060000000006060 +00000060000000006000000000600000000000606000000000000000000000000000000000000000000000006060000000000060000000006000000000600000 +00000000600000000060000000006000000000000060606060606060606060600060606060606060606060600000000000006000000000600000000060000000 +60600000006000000000000000000060000000000000000000000000000000006000000000000000000000000000000000600000000000000000006000000060 +00006000000060000000600000000000606000000000000000000000000000000000000000000000000000000000006060000000000060000000600000006000 +00000060000000600000006000000000000060606060606060606060606060606060606060606060606060606060600000000000006000000060000000600000 +60000000600000006000000060000000000000000000000000000000606060606060606060000000000000000000000000000000600000006000000060000000 +00600000000000000000000000606000000000000000000060606060606060606060606060606060600000000000000000006060000000000000000000000060 +00006000006000000060000000000060606060606060606060606060606000000000006060606060606060606060606060600000000000600000006000006000 +00000000000060000000600000000000000000000000606060606060606060606060606060606060606060000000000000000000000060000000600000000000 +60000060000000600000006060000000000000006060606060600000000000000000000000000060606060606000000000000000606000000060000000600000 +00000000600000006000000000606060606060606060606000000000000000000000000000000000006060606060606060606060000000006000000060000000 +00600000000000000060000000000000000000606060606060606060606060606060606060606060606060606060000000000000000000600000000000000060 +00006000006000000000600000000000006060606060000000000000000000000000000000000000000000606060606000000000000060000000006000006000 +00000060000060000000006060606060600060600000000000000000000000000000000000000000000000000060600060606060606000000000600000600000 +60000000000000600000000000000000606060606060606060606060606000000000006060606060606060606060606060000000000000000060000000000000 +00600000600000006000000000000060606060000000000000000000000060606060600000000000000000000000606060600000000000006000000060000060 +00000000006000000060606060606060606000000000000000000000000000000000000000000000000000000000006060606060606060600000006000000000 +00006000000060000000000000006060606060606060606060000000000000000000000000000000606060606060606060606000000000000000600000006000 +60000060000000600000000000606060600000000000000000606000000000000000000000006060000000000000000060606060000000000060000000600000 +00000000000000006060606060006060000000000000000000000060606000000000006060600000000000000000000000606000606060606000000000000000 +00600000600000000000000000606000606060606060000000000000000060606060600000000000000000606060606060006060000000000000000060000060 +00006000006000000000006060600060000000000000600000000000000000000000000000000000000060000000000000600060606000000000006000006000 +00000000000060606060600060606000000000000000006060000000000000000000000000000000606000000000000000006060600060606060600000000000 +60000060000000000000006060606060606060600000000000600000000000000000000000000060000000000060606060606060606000000000000000600000 +00600000600000000000606060600000000000006000000000006060000000000000000000606000000000006000000000000060606060000000000060000060 +00000000006060606060000060000000000000000060000000000000606060600060606060000000000000600000000000000000600000606060606000000000 +00006000000000000000606000606060606000000000600000000000000000006000000000000000000060000000006060606060006060000000000000006000 +60000060000000000060606060000000000060000000006000000000000000000000000000000000006000000000600000000000606060600000000000600000 +00600000606060606060606000000000000000600000000060600000000000000000000000000060600000000060000000000000006060606060606060000060 +00000000000000000000000060606060600000006000000000006000000000000000000000006000000000006000000060606060600000000000000000000000 +00006000000000006060606000000000006000000060000000000060600000000000000060600000000000600000006000000000006060606000000000006000 +60000060606060606060600000000000000060000000600000000000006060606060606000000000000060000000600000000000000060606060606060600000 +00000000000000000000006060606060000000000000006000000000000000000000000000000000006000000000000000606060606000000000000000000000 +00600000000000606060600000000000600000600000000060000000000000000000000000000000600000000060000060000000000060606060000000000060 +00006060006060600000000000000000000000006000000000600000000000000000000000000060000000006000000000000000000000000060606000606000 +60000000600000006060006060606000006000000060000000006060000000000000000000606000000000600000006000006060606000606000000060000000 +00600000000060606000600000000060000060000000600000000000606060606060606060000000000060000000600000600000000060006060600000000060 +00006060606000000060000000000000000000600000006000000000000000000000000000000000006000000060000000000000000000600000006060606000 +00000000000060606000606060600000600000000000000060000000000000000000000000000000600000000000000060000060606060006060600000000000 +60000000006000000060000000006000006000006000000000606000000000000000000000006060000000006000006000006000000000600000006000000000 +00606060600060606000000000000060000000000060000000000060606060606060606060600000000000600000000000600000000000006060600060606060 +00000000006000000000606060000000000060000000600000000000000000000000000000000000000060000000600000000000606060000000006000000000 +00000000600060600060000000600000600000600000006000000000000000000000000000000000006000000060000060000060000000600060600060000000 +60606060006000006000000000006000000000000000000060606060606060606060606060606060600000000000000000006000000000006000006000606060 +00000000000060600060606060000060006000006000000000000000000000000000000000000000000000006000006000600000606060600060600000000000 +00000000600000006000000000600000000060000060000000000000006060606060606000000000000000600000600000000060000000006000000060000000 +60606060006060000000000000006000600000000000606060606060606060606060606060606060606060000000000060006000000000000000606000606060 +00000000600000600060606060000000000000600000000000000000606060606060606060000000000000000060000000000000606060600060000060000000 +00000060006000006000000000000060006000006000000000006060606060000000606060606000000000006000006000600000000000006000006000600000 +60606000000060600000000000600000000060000060606060600060600000000000000060600060606060600000600000000060000000000060600000006060 +00000000606000000060606000006000600000000000000000006060006060606060606000606000000000000000000060006000006060600000006060000000 +00000060000060006000000060000000000000600000000000606060600000000000000060606060000000000060000000000000600000006000600000600000 +60606000600000600000000000600060006000006060606060606000000000000000000000006060606060606000006000600060000000000060000060006060 +00000000006000000060606000006000000060000000000000000060006060606060606000600000000000000000600000006000006060600000006000000000 +00000060000060006000000060000000600000600000000060606000600000000000000060006060600000000060000060000000600000006000600000600000 +60606000600000600000000000600060006000006060606000000060000000000000000000600000006060606000006000600060000000000060000060006060 +00000060006000000060606000000000000000000000000060600000006060606060606000000060600000000000000000000000006060600000006000600000 +00000000600060006000000060006000600060000000006000006000600000000000000060006000006000000000600060006000600000006000600060000000 +60606000000000600000000000600060000000606060600060000060000000000000000000600000600060606060000000600060000000000060000000006060 +00000060006000000060606060000000006000000000006000600000000060606060600000000060006000000000006000000000606060600000006000600000 +00006000600060006000000000006000600060000000000060006000006000000000006000006000600000000000600060006000000000006000600060006000 +60600000000000600000000000600060000000606060600000000000600000000000000060000000000060606060000000600060000000000060000000000060 +00000060006000000060606060006000006000000000006000600060000000000000000000600060006000000000006000006000606060600000006000600000 +00006000600060006000000000600000600060000000600060000000000060606060600000000000600060000000600060000060000000006000600060006000 +00600000000000600000000000000060000000600060000000006000006000000000006000006000000000600060000000600000000000000060000000000060 +60000060006000000060606060006000006000006000006000600000600000000000000060000060006000006000006000006000606060600000006000600000 +00006000000060006000000000600000600060000000600000000060000000000000000000600000000060000000600060000060000000006000600000006000 +60600000600000000000000000006060000000606060000060000000000000000000000000000000600000606060000000606000000000000000000060000060 +00000060006000600000606060600000606000000000000000006000000060606060600000006000000000000000006060000060606060000060006000600000 +00006000000000000060000000000060000060000000006000600000006000000000006000000060006000000000600000600000000000600000000000006000 +60600000600060006000000000006000006000606060600000000000600000000000000060000000000060606060006000006000000000006000600060000060 +00000060000000000000606060600060600000000000000060000060000000000000000000600000600000000000000060600060606060000000000000600000 +00000000006000600060000000006000006060000000006000000000000000000000000000000000006000000000606000006000000000600060006000000000 +60606000600060000000000000000060600000606060600000006000000000000000000000006000000060606060000060600000000000000000600060006060 +00000000000000006000006060606000606060000000000000600000000060606060600000000060000000000000606060006060606000006000000000000000 +00000060006000600000600000000060000000600000000060000000606000000000006060000000600000000060000000600000000060000060006000600000 +60606000000000000060000000000000606060006060606000000060000000000000000000600000006060606000606060000000000000600000000000006060 +00000000600060000000000060606060000000600000000000006000000000000000000000006000000000000060000000606060600000000000600060000000 +00000060000000006000006000000000606060006000000000600000000000000000000000000060000000006000606060000000006000006000000000600000 +60606000006000600000600000000000006060600060606060000000000000606060000000000000606060600060606000000000000060000060006000006060 +00000000600000000060000060606060600060006000000000000000006060000000606000000000000000006000600060606060600000600000000060000000 +00000000000060000000000000000000006000600060000000000060600000000000000060600000000000600060006000000000000000000000600000000000 +60606060000000006000006000000000000060606000606060606000000000000000000000006060606060006060600000000000006000006000000000606060 +00000000006000600000600000006060606060606060000000000000000000000000000000000000000000606060606060606000000060000060006000000000 +00000000600000000060000000600000000000606000600000000000000000606060000000000000000060006060000000000060000000600000000060000000 +60606060000060000000000060000000000000006060006060606060606060000000606060606060606000606000000000000000600000000000600000606060 +00000000000000006000006000000060606060600060600000000000000000000000000000000000000060600060606060600000006000006000000000000000 +60000000006000000000600000006000000000006060606060000000000000000000000000000000606060606000000000006000000060000000006000000000 +00606060600000600000000000600000000000000000606000606060606060606060606060606060006060000000000000000060000000000060000060606060 +00000000000060000060000060000000606060606060606060600000000000000000000000000060606060606060606060000000600000600000600000000000 +60000000006000006000006000000060000000000000006060606060000000000000000000606060606000000000000000600000006000006000006000000000 +00606060600000000000000000006000000000000000000060606060606060606060606060606060600000000000000000006000000000000000000060606060 +60000000000000600000600000600000000060606060606060606060606000000000006060606060606060606060600000000060000060000060000000000000 +00600000000060000060000000000000006000000000000000006060606060606060606060606000000000000000006000000000000000600000600000000060 +60006060606000000000000060000000600000000000000000000000006060606060606000000000000000000000000060000000600000000000006060606000 +60600000000000006000006000000060000000006060606060606060606060606060606060606060606060606000000000600000006000006000000000000060 +00006000000000600000000000006000000000600000000000000000000000000000000000000000000000000060000000006000000000000060000000006000 +60600060606060000000600000600000000060000000000000000000000000000000000000000000000000000000600000000060000060000000606060600060 +00006000000000000060000000000000006000000000006060606060606060606060606060606060606000000000006000000000000000600000000000006000 +60600060000000006000000060000000600000000060600000000000000000000000000000000000000060600000000060000000600000006000000000600060 +60606000606060600000006000000060000000006000000000000000000000000000000000000000000000006000000000600000006000000060606060006060 +00000000000000000000600000006000000000600000000000000000606060606060606060000000000000000060000000006000000060000000000000000000 +60606060000000000060000000600000000060000000000000606060000000000000000000606060000000000000600000000060000000600000000000606060 +00606060606060606000000060000000006000000000006060000000000000000000000000000000606000000000006000000000600000006060606060606060 +60006000600000000000000000000000600000000000600000000000000000000000000000000000000060000000000060000000000000000000000060006000 +00600060006000000000606000000060000000006060000000000000000000000000000000000000000000606000000000600000006060000000006000600060 +00006060600060606060000000006000000000600000000000000000606060606060606060000000000000000060000000006000000000606060600060606000 +60600060606000000000000000600000000060000000000000006060000000000000000000606000000000000000600000000060000000000000006060600060 +00006000600060000000000060000000006000000000000060600000000000000000000000000060600000000000006000000000600000000000600060006000 +00000060006000606060606000000000600000000000606000000000000000000000000000000000006060000000000060000000006060606060006000600000 +60606060606060000000000000000060000000000060000000000000000000000000000000000000000000600000000000600000000000000000606060606060 +00000000606060600000000000006000000000006000000000000000000000000000000000000000000000006000000000006000000000000060606060000000 +00000000006060606060606060600000000060600000000000000060606060606060606060600000000000000060600000000060606060606060606000000000 +60606060600060000000000000000000006000000000000000606000000000000000000000006060000000000000006000000000000000000000600060606060 +00000000006060606060000000000000600000000000006060000000000000000000000000000000606000000000000060000000000000606060606000000000 +00000000000000606000606060606060000000000000600000000000000000000000000000000000000060000000000000606060606060006060000000000000 +00606060606060006060000000000000000000006060000000000000000000000000000000000000000000606000000000000000000000606000606060606060 +60000000000000606060600000000000000060600000000000000000000060606060600000000000000000000060600000000000000060606060000000000000 +00000000000000006060606060606060606000000000000000006060606000000000006060606000000000000000006060606060606060606000000000000000 +00000000000000000060606000000000000000000000000060600000000000000000000000000060600000000000000000000000006060600000000000000000 +00000000000000000000606060000000000000000060606000000000000000000000000000000000006060600000000000000000606060000000000000000000 +00000000000000000000006060606060606060606000000000000000000000000000000000000000000000006060606060606060606000000000000000000000 +00000000000000000000000060600000000000000000000000000000000000000000000000000000000000000000000000000060600000000000000000000000 +00000000000000000000000000606060000000000000000000006060606060606060606060606000000000000000000000606060000000000000000000000000 + diff --git a/myfirstgame.p8 b/myfirstgame.p8 new file mode 100644 index 0000000..4646ada --- /dev/null +++ b/myfirstgame.p8 @@ -0,0 +1,310 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ +function _init() + mymap={ + w=32, + h=9 + } + initcoins() + initplayer() +end + +function _update() + updateplayer() + if btn(4) then + reload() + _init() + end +end + +function _draw() + cls() + camera(player.x-20,-20) + map(0,0,0,0,mymap.w,mymap.h) + drawcoins() + drawplayer() +end +-->8 +function initplayer() + player={ + x=8, + y=56, + dir=false, + vv=0, + vh=2, + w=8, + h=8, + image=3, + timer=0, + walking=false, + jumping=false + } + v0=-4.5 + gravity=0.5 +end + + +function updateplayer() + local dx=0 + local dy=0 + +--walk + if btn(⬅️) and player.x>=10 then + dx=-player.vh + player.dir=true + for i=1,player.vh do + local new_x,new_y,_,_=trymove(player.x,player.y,-1,0) + player.x=new_x + if isonground() then + sfx(2) + end + walking=true + end + + elseif btn(➡️) and player.x<=mymap.w*8-player.w-10 then + dx=player.vh + player.dir=false + for i=1,player.vh do + local new_x,new_y,_,_=trymove(player.x,player.y,1,0) + player.x=new_x + if isonground() then + sfx(2) + end + walking=true + end + + else walking=false + end--if + +--jump & fall + if isonground() then + player.vv=0 + if btn(⬆️) then + sfx(1) + player.vv=v0 + walking=false + end + else + player.vv+=gravity + end + + dy=player.vv + if dy>0 then + dy=ceil(dy) + for i=1,dy do + local new_x,new_y,_,actual_dy=trymove(player.x,player.y,0,1) + player.y=new_y + if actual_dy==0 then + player.vv=0 + break + end --if + end --for + + elseif dy<0 then + dy=flr(dy) + for i=1,-dy do + local new_x,new_y,_,actual_dy=trymove(player.x,player.y,0,-1) + player.y=new_y + if actual_dy==0 then + player.vv=0 + end --if + end --for + end + +--image state + if isonground()==false then + walking=false + jumping=true + else jumping=false + end + +--eat coins + eatcoin(player.x+3,player.y+4) + +end + +function drawplayer() + if walking==true then + player.timer+=1 + if player.timer%6==0 then + if player.image==3 then + player.image=19 + else + player.image=3 + end + end + elseif jumping==true then + player.image=35 + else player.image=3 + end + spr(player.image,player.x,player.y,1,1,player.dir) +end +-->8 +function issolid(x,y) + local tile=mget(flr(x/8),flr(y/8)) + local f=fget(tile) + if f==1 then + return true + else return false + end--if +end + +function trymove(x,y,dx,dy) + local new_x=x+dx + local new_y=y+dy + local collided_x=false + local collided_y=false + + if dx>0 then --right + for i=0,player.h-1 do + if issolid(new_x+player.w-1,new_y+i) then + collided_x=true + break + end --if + end --for + end --if + if dx<0 then --left + for i=0,player.h-1 do + if issolid(new_x,new_y+i) then + collided_x=true + break + end --if + end --for + end --if + if dy>0 then --down + for i=0,player.w-1 do + if issolid(new_x+i,new_y+player.h-1) then + collided_y=true + break + end --if + end --for + end --if + if dy<0 then --up + for i=0,player.w-1 do + if issolid(new_x+i,new_y) then + collided_y=true + break + end --if + end --for + end --if + + if new_y<0 then + dy=0 + collided_y=true + end + + if collided_x==true then + dx=0 + end + if collided_y==true then + dy=0 + end + + return x+dx,y+dy,dx,dy +end + +function isonground() + for i=0,player.w-1 do + if issolid(player.x+i,player.y+player.h) then + return true + end --if + end --for + return false +end +-->8 +function initcoins() + score=0 + coins={} + for x=0,mymap.w do + for y=0,mymap.h do + local tile=mget(x,y) + if tile==4 then + add(coins,{ + x=x*8, + y=y*8, + w=6, + collected=false, + timer=0 + }) + mset(x,y,2) + end--if + end + end +end + +function eatcoin() + for c in all(coins) do + if c.collected==false and isoverlap(c.x,c.y,c.w)==true then + c.collected=true + sfx(0) + score+=1 + c.timer=3 + end--if + end--for +end + +function isoverlap(x0,y0,w0) + local x=player.x + local y=player.y + if x+player.wx0+w0+(8-w0)/2 or y+player.hy0+w0+(8-w0)/2 then + return false + else return true + end +end + +function drawcoins() + for c in all(coins) do + if c.collected==false then + spr(5,c.x,c.y) + elseif c.timer>0 then + spr(21,player.x+8,player.y) + spr(21,player.x-8,player.y,1,1,1) + c.timer-=1 + end--if + end + print("score:"..score,player.x-5,1,4) +end + +__gfx__ +0000000033b3b3b377777777002eeee0777777770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000003b333b33777777c722222eee779a9a77009a9a0000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0070070033333333777777770557975079a9a9a709a9a9a000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000444444447c7777775591919579aaaa9709aaaa9000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0007700045444544777777770599899079aaa9a709aaa9a000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700444544447777777700e2e2e0799aaa97099aaa9000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000004444445477777c770e02220e779999770099990000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000454444447777777700020200777777770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000004454444477777777002eeee0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000054444454777777c722222eee000000000009a00000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000444544447777777705579750000000000090000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000444444447c77777755919195000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000045444544b77777b7059989900000000000990a0000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000444544447b777b7700e2e2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000444444547b77b777000e22e0000000000090000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000004544444477b7b77700022000000000000009a00000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000002eeee0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000022222eee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000005519150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000055979795000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000e99899e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000e2e2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000022200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000200020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__gff__ +0001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__map__ +0202020202020202020204020202020202020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202020202020202020202020202020202020204020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020402020202020202020202020202020202020402021202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202010101020202020202020202020202010101020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202120402020202020202020402020212020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020201010102020202020202020202020101010202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202021202020202020201011104020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0212120202020202010101020212020111111102020202020202121202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0101010101010101111111010101011111111101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__sfx__ +000300001a0101d0201f0302004023050260402b03030020360103800037000360003400034000370003600036000340003400033000320003200022000220002200000000000000000000000000000000000000 +000100000f0601106011070110701107013070140701506016060190001a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00010000210401b000130001300000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/test.p8 b/test.p8 new file mode 100644 index 0000000..b96a2f6 --- /dev/null +++ b/test.p8 @@ -0,0 +1,9 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/timetest.p8 b/timetest.p8 new file mode 100644 index 0000000..ba6c1a2 --- /dev/null +++ b/timetest.p8 @@ -0,0 +1,282 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ +twodays=172800 +timescale=1 +stime={} +ctime={} +function _init() + printh("init") + + cartdata("savedgame") + timeset = dget(0) + stime=dt:new() + + if (timeset==0) then + stime:from(currenttime()) + printh("save:"..stime:tostring()) + stime:save() + else + stime:read() + printh("read:"..stime:tostring()) +-- printh("starttime = ".. ) + end + + cls() +-- printh("goaltime"..goaltime) + m:draw() + ui:draw() + +end + +function _update() + ctime=dt:new() + + ctime:from(currenttime()) + if (btn(⬆️)) and + (btn(⬇️)) and + (btn(⬅️)) and + (btn(➡️)) and + (btn(❎)) and + (btn(🅾️)) then + dset(0,0) + printh("save reset") + end + if (btn(🅾️)) printh(ctime:tostring()) + xv = 0 + yv = 0 + if (btn(➡️)) xv+=p.s + if (btn(⬅️)) xv-=p.s + if (btn(⬆️)) yv-=p.s + if (btn(⬇️)) yv+=p.s + p:input(xv,yv) + p:move() + what=ctime:tdiff(stime) + if (btn(❎)) printh(what)--printh(stime:tostring()) + + k:update(what) +end + +function _draw() + m:draw() + ui:draw() + p:draw() + k:draw() +end +-->8 +p = { --player + s=0, + x=64, + y=32, + w=8, + h=8, + s=1, + xv = 0, + yv = 0, + draw = function(self) + spr(s,self.x,self.y) + end, + input = function(self, xv, yv) + self.xv = xv + self.yv = yv + end, + move = function(self) + if not (hitx(self.x+self.xv,self.y,self.w,self.h)) then + self.x+= self.xv + end + if not (hity(self.x,self.y+self.yv,self.w,self.h)) then + self.y+= self.yv + end + end +} + +k={ --kid + s=1, + x=20, + y=20, + m=1, --modifier + t = 0, + growtime=1.30, -- 1 min 30 sec + update = function(self,t) + self.t=t*self.m + pa = self.t/self.growtime + if (pa8 +m = { --map + rox=0, + roy=0, + draw = function(self) + map(0,0,0,0,16,8) + end + +} + +ui = { + draw= function(self) + rectfill(0,128,256,256,1) + + end +} + +dt = { + s=0, + m=0, + h=0, + d=0, + mo=0, + y=0, + tostring= + function(self) + return self.s..":" + ..self.m..":" + ..self.h.." " + ..self.d.."-" + ..self.mo.."-" + ..self.y + end, + + from=function(self, obj) + self.s = obj.s + self.m = obj.m + self.h = obj.h + self.d = obj.d + self.mo = obj.mo + self.y = obj.y + end, + save=function(self) + dset(1,self:dat()) + dset(2,self:tim()) + dset(0,1) + end, + read=function(self) + dat=dget(1) + tim=dget(2) + dat/=10 + self.y = flr(dat) + dat = (dat-self.y)*100 + self.mo= flr(dat) + dat = (dat-self.mo)*100 + self.d=flr(dat) + tim/=100 + self.h=flr(tim) + tim = (tim - self.h)*100 + self.m=flr(tim) + tim = (tim-self.m)*100 + self.s = flr(tim) + + end, + dat=function(self) + return self.y*10+self.mo/10+self.d/1000 + end, + tim=function(self) + return self.h*100+self.m+self.s/100 + end, + tdiff=function(self,obj) + return self:tim()-obj:tim() + end, + ddiff=function(self,obj) + return self:dat()-obj:dat() + end + +} + + +function dt:new(obj) + obj = obj or {} + setmetatable(obj, {__index = self}) + return obj +end +-->8 +-- check hit on top or bottom +function hity(x,y,w,h) --check hit on top or bottom + hit=false + for i=x,x+w do + tile1=mget(i/8,y/8) + tile2=mget(i/8,(y+h)/8) + if (fget(tile1,0)) then + hit=true + elseif (fget(tile2,0)) then + hit=true + end + end + return hit +end +--check hit on sides +function hitx(x,y,w,h) --check hit on sides + hit = false + for i=y,y+h do + tile1=mget(x/8,i/8) + tile2=mget((x+w)/8,i/8) + if (fget(tile1,0)) then + hit=true + elseif (fget(tile2,0)) then + hit=true + end + end + return hit +end + + +-- returns the current time. +--i have to split it up fml +function currenttime() + + t = { + s=stat(95), + m=stat(94), + h=stat(93), + d=stat(92), + mo=stat(91), + y=stat(90) + } + return t +end +__gfx__ +00000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000001111110166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000011110001611610166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000110000011610001612610166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000110000011110001111110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000011110001211110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000001111110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222dddddddd5555555555555554555555554444444455555555555444445555555544445555000000000000000000000000000000000000000000000000 +22222222d555555d5555555555555554555555555555555555555555555444445555555544445555000000000000000000000000000000000000000000000000 +22222222d555555d5555555555555554555555555555555555555555555444445555555544445555000000000000000000000000000000000000000000000000 +22222222d555555d5555555555555554555555555555555544444555555444445555555544445555000000000000000000000000000000000000000000000000 +22222222d555555d5555555555555554555555555555555544444555555444445554444455555555000000000000000000000000000000000000000000000000 +22222222d555555d5555555555555554555555555555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +22222222d555555d5555555555555554555555555555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +22222222dddddddd5555555555555554444444445555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +00000000007777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000007777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000077cc7700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000007cccc700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000077777700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000077777700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000077777700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000007777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__gff__ +0000000000000000000000000000000000010101010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__map__ +1212121212121212121212121212121200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1218141414141414141414141414161200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1213101010101010101010101010111200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1213101010101010101010101010111200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1213101010101010101010101010111200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1213101010101010101010101010111200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1213101010101010101010101010111200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1217151515151515151515151515191200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1212121212121212121212121212121200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/trywater.p8 b/trywater.p8 new file mode 100644 index 0000000..05acf93 --- /dev/null +++ b/trywater.p8 @@ -0,0 +1,594 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ +function _init() + mymap={ + w=36, + h=11, + } + coins_collected=false + chest_collected=false + initcoins() + initkey() + initchest() + initplayer() + initwater() + poke(0x5f5c,255) --disable btnp repeat +end + +function _update() + updatewater() + updateplayer() + if btn(❎) then + reload() + _init() + end +end + +function _draw() + cls() + camera(player.x-20,-15) + map(0,0,0,0,mymap.w,mymap.h) + drawcoins() + drawkey() + drawchest() + drawwater() + drawplayer() + if coins_collected==true and chest_collected==true then + print("you win!\npress x to restart",player.x-5,9,3) + end +end +-->8 +function initplayer() + player={ + x=8, + y=mymap.h-8, + dir=false, + vv=0, + vh=2, + w=8, + h=8, + image=3, + timer=0, + walking=false, + jumping=false, + inwater=false + } + v0=-4.5 + gravity=0.5 + vf=-1 + v1=-2 +end + + +function updateplayer() + local dx=0 + local dy=0 + +--walk + if btn(⬅️) and player.x>=10 then + dx=-player.vh + player.dir=true + for i=1,player.vh do + local new_x,new_y,_,_=trymove(player.x,player.y,-1,0) + player.x=new_x + walking=true + end + + elseif btn(➡️) and player.x<=mymap.w*8-player.w-10 then + dx=player.vh + player.dir=false + for i=1,player.vh do + local new_x,new_y,_,_=trymove(player.x,player.y,1,0) + player.x=new_x + walking=true + end + + else walking=false + end--if + +--jump & fall + player.inwater=isinwater(player.x+4,player.y+4) + + if player.inwater==false then + + if isonground() then + player.vv=0 + if btnp(⬆️) then + sfx(1) + player.vv=v0 + walking=false + end + else + player.vv+=gravity + end + + dy=player.vv --falling + if dy>0 then + dy=ceil(dy) + for i=1,dy do + local new_x,new_y,_,actual_dy=trymove(player.x,player.y,0,1) + player.y=new_y + if actual_dy==0 then + player.vv=0 + break + end --if + end --for + + elseif dy<0 then --jumping + dy=flr(dy) + for i=1,-dy do + local new_x,new_y,_,actual_dy=trymove(player.x,player.y,0,-1) + player.y=new_y + if actual_dy==0 then + player.vv=0 + end --if + end --for + end + end + +----in water + + if player.inwater==true then + + player.vv=vf + dy=player.vv + for i=1,-dy do + local new_x,new_y,_,actual_dy=trymove(player.x,player.y,0,-1) + player.y=new_y + if actual_dy==0 then + player.vv=0 + end + end + + end + + if player.inwater==true or isinwater(player.x+4,player.y+12) then + if btnp(⬆️) then --jump in water + sfx(1) + player.vv=v1 + end + end + +--image state + if isonground()==false then + walking=false + jumping=true + else jumping=false + end + +--eat coins + if coins_collected==false then + eatcoin() + end + getkey() + if chest_collected==false then + openchest() + end + +end + +function drawplayer() + if player.inwater==true then + player.image=36 + elseif walking==true then + player.timer+=1 + if player.timer%6==0 then + sfx(2) + if player.image==3 then + player.image=19 + else + player.image=3 + end + end + elseif jumping==true then + player.image=35 + else player.image=3 + end + spr(player.image,player.x,player.y,1,1,player.dir) +end + +------------ + +function issolid(x,y) + local tile=mget(flr(x/8),flr(y/8)) + local f=fget(tile) + if f==1 then + return true + else return false + end--if +end + +function trymove(x,y,dx,dy) + local new_x=x+dx + local new_y=y+dy + local collided_x=false + local collided_y=false + + if dx>0 then --right + for i=0,player.h-1 do + if issolid(new_x+player.w-1,new_y+i) then + collided_x=true + break + end --if + end --for + end --if + if dx<0 then --left + for i=0,player.h-1 do + if issolid(new_x,new_y+i) then + collided_x=true + break + end --if + end --for + end --if + if dy>0 then --down + for i=0,player.w-1 do + if issolid(new_x+i,new_y+player.h-1) then + collided_y=true + break + end --if + end --for + end --if + if dy<0 then --up + for i=0,player.w-1 do + if issolid(new_x+i,new_y) then + collided_y=true + break + end --if + end --for + end --if + + if new_y<0 then + dy=0 + collided_y=true + end + + if collided_x==true then + dx=0 + end + if collided_y==true then + dy=0 + end + + return x+dx,y+dy,dx,dy +end + +function isonground() + for i=0,player.w-1 do + if issolid(player.x+i,player.y+player.h) then + return true + end --if + end --for + return false +end + +---------- +function isinwater(x,y) + local x1=flr(x/8) + local y1=flr(y/8) + if water_state[x1][y1]==true then + return true + else return false + end--if +end + +-->8 +function initwater() + water_map={} + water_state={} + water_level=mymap.h-1 + rising=true + water_timer=90 + + for x=0,mymap.w-1 do + water_map[x]={} + water_state[x]={} + for y=0,mymap.h-1 do + local tile=mget(x,y) + local f=fget(tile) + if f!=1 and f!=4 then + water_map[x][y]=true --not solid + else water_map[x][y]=false --ground + end--if + water_state[x][y]=false + end + end +end + +function water_rise() + if water_level>0 then + water_level-=1 + for i=0,mymap.w-1 do + if water_map[i][water_level]==true then + water_state[i][water_level]=true + end + end + end +end + +function water_fall() + if water_level8 +function initcoins() + score=0 + totalscore=8 + coins={} + for x=0,mymap.w do + for y=0,mymap.h do + local tile=mget(x,y) + if tile==5 then + add(coins,{ + x=x*8, + y=y*8, + w=6, + collected=false, + timer=0 + }) + mset(x,y,2) + end--if + end + end +end + +function eatcoin() + for c in all(coins) do + if c.collected==false and isoverlap(c.x,c.y,c.w)==true then + c.collected=true + sfx(0) + score+=1 + c.timer=3 + end--if + end--for +end + +function isoverlap(x0,y0,w0) + local x=player.x + local y=player.y + if x+player.wx0+w0+(8-w0)/2 or y+player.hy0+w0+(8-w0)/2 then + return false + else return true + end +end + +function drawcoins() + for c in all(coins) do + if c.collected==false then + spr(5,c.x,c.y) + elseif c.timer>0 then + spr(21,player.x+8,player.y) + spr(21,player.x-8,player.y,1,1,1) + c.timer-=1 + end--if + end + print("score:"..score,player.x-5,1,4) + if score==totalscore then + coins_collected=true + end +end + +------------ + +function initkey() + for x=0,mymap.w do + for y=0,mymap.h do + local tile=mget(x,y) + if tile==6 then + key={ + x=x*8, + y=y*8, + w=6, + collected=false + } + mset(x,y,34) + break + end--if + end + end +end + +function getkey() + if key.collected==false and isoverlap(key.x,key.y,key.w)==true then + key.collected=true + sfx(0) + end--if +end + +function drawkey() + if key.collected==false then + spr(6,key.x,key.y) + elseif chest_collected==false then + print("key:z to use",player.x+30,1,4) + end +end + +function initchest() + for x=0,mymap.w do + for y=0,mymap.h do + local tile=mget(x,y) + if tile==7 then + chest={ + x=x*8, + y=y*8, + w=8, + collected=false, + timer=0 + } + mset(x,y,2) + spr(7,key.x,key.y) + break + end--if + end + end +end + +function openchest() + if btnp(🅾️) and key.collected==true and chest.collected==false and isoverlap(chest.x,chest.y,chest.w)==true then + chest.collected=true + chest_collected=true + sfx(3) + chest.timer=15 + end--if +end + +function drawchest() + if chest.collected==false then + spr(7,chest.x,chest.y) + else + if chest.timer>0 then + chest.timer-=1 + spr(8,chest.x,chest.y-12+chest.timer/3) + end + spr(23,chest.x,chest.y) + print("treasure found!",player.x+30,1,4) + end +end +__gfx__ +0000000033b3b3b377777777002eeee0cccccccc00000000000000000c1111c00000000000000000000000000000000000000000000000000000000000000000 +000000003b333b3377777f7722222eeec11cc11c009a9a0000000cc0c111111c0100001000000000000000000000000000000000000000000000000000000000 +007007003333333377777777055797501cc11cc109a9a9a00000c880999889990100001000000000000000000000000000000000000000000000000000000000 +00077000444444447f77777755919195cccccccc09aaaa90000c8800c118811c0000000000000000000000000000000000000000000000000000000000000000 +00077000454445447777777705998990cccccccc09aaa9a00cc88000c118811c0eeeeee000000000000000000000000000000000000000000000000000000000 +00700700444544447777777700e2e2e0c11cc11c099aaa900c080000c111111c00eeee0000000000000000000000000000000000000000000000000000000000 +00000000444444547777f7770e02220e1cc11cc10099990008880000c111111c000ee00000000000000000000000000000000000000000000000000000000000 +00000000454444447777777700020200cccccccc0000000000000000c111111c0000000000000000000000000000000000000000000000000000000000000000 +000000004454444477777777002eeee000c100c10000000000000000c111111c0000000000000000000000000000000000000000000000000000000000000000 +00000000544444547777777722222eeec11cc11c0009a000000000000c19a1c00000000000000000000000000000000000000000000000000000000000000000 +000000004445444477777777055797501cc11cc100900000000000000c9e9ac00000000000000000000000000000000000000000000000000000000000000000 +00000000444444447777777755919195cccccccc0000000000000000c9a9e9ac0000000000000000000000000000000000000000000000000000000000000000 +0000000045444544b77777b705998990cccccccc00990a0000000000cccccccc0000000000000000000000000000000000000000000000000000000000000000 +00000000444544447b777b7700e2e2e0c11cc11c0000000000000000c111111c0000000000000000000000000000000000000000000000000000000000000000 +00000000444444547b77b777000e22e01cc11cc10090000000000000c111111c0000000000000000000000000000000000000000000000000000000000000000 +000000004544444477b7b77700022000cccccccc0009a00000000000c111111c0000000000000000000000000000000000000000000000000000000000000000 +000000000000000077777777002eeee0002eeee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000007777777722222eee22222eee0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000007777c77705519150055191500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000007777777755979795559797950000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000007c7777770e99899e009989900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000007777777700e2e2e00ee2e2ee0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000777777c700022200700222070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000007777777700200020007202700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__gff__ +0001000002000000000000000000000000010000020000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__map__ +0202020202020202020202020202020202020202020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202020202020202050202020202020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202020202020202020202020202020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202020201010101010102020202020202020202020202020205020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202020211222222221102020202020202020702020202020201010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202010111062222221102020202020202010101020202020211111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020205120202020211111102020202020212020202020202020202020211111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020201010102020202020202020202020101010202020202020202020211111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0202020202020202021202020202020201011105020202020202020202020211111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0212120202020202010101020212010111110202020202021202121202020211111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0101010101010101111111010101111111111101010101010101010101010111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__sfx__ +000200001a0101d0201f0202002023020260202b02030020360103800037000360003400034000370003600036000340003400033000320003200022000220002200000000000000000000000000000000000000 +0101000013050130501106013060180601a0601c0501d000287002870028700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000100000c0510c0062eb0630b0732b0736b0700000080000c0000e8061cb05303000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000800001850015560175601856015560185601c5601f5601f560255002c5002a0002b0002a000290002800027000250002300021000210002100022000220000000000000000000000000000000000000000000 +0010000000000000000000026050240502305022050200501d0501905015050120501105011050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0020000018a5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/untitled.p8 b/untitled.p8 new file mode 100644 index 0000000..1d878e7 --- /dev/null +++ b/untitled.p8 @@ -0,0 +1,34 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ +function _init() +x=64 +y=64 +z=false +end + +function _update() +if(btn(⬅️))x-=1 +if(btn(➡️))x+=1 +if(btn(⬆️))y-=1 +if(btn(⬇️))y+=1 +if(btn(❎))z=not z + +if(z) then s=1 else s=0 end + +end + + +function _draw() +cls() +spr(s,x,y) +end +__gfx__ +00000000444444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000445544440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700444454440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000445544440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000444454440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700444444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000444444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000444444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/untitled_1.p8 b/untitled_1.p8 new file mode 100644 index 0000000..08ab262 --- /dev/null +++ b/untitled_1.p8 @@ -0,0 +1,50 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ +-- + +function _init() +y=(stat(80)-2025)*365*24*60*60 +end + +function _update() +m=stat(81)-8 +d=stat(82) +if(m>=0)then +d=2-d +else +m= (m+1)*30 +d=30-d +end + +h=24-stat(83) +mi=60-stat(84) +s=60-stat(85) + +end + +function _draw() +cls() + +print(m) +print(d) +print(h) +print(mi) +print(s) +sprint('hi',56,20) +sprint('it seems you only have',20,40) +sprint(d..' days '..h..':'..mi..':'..s,30,64) +sprint('to live',47,80) +end + +function sprint(s,x,y) +print(s,x,y,1) +print(s,x-1,y-1,8) +end +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/untitled_2.p8 b/untitled_2.p8 new file mode 100644 index 0000000..d1d5b96 --- /dev/null +++ b/untitled_2.p8 @@ -0,0 +1,19 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000004000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000 +00700700004444000040000000000000000004000044440000444400004444000040000000400000000000000040040000400000040004000000000000444400 +00077000004004000040000000000000004444000040000000400000004000000040040000000000000040000040400000400000044044000040040000400400 +00077000004004000044440000444400004004000044440000444000004000000040040000400000000040000044000000400000040404000044040000400400 +00700700004444000040040000400000004004000040000000400000004044000044440000400000000040000040400000400000040004000040440000400400 +00000000004004000040040000400000004004000040000000400000004004000040040000400000000040000040040000400000040004000040040000400400 +00000000004004000044440000444400004444000044440000400000004444000040040000400000004400000040040000444400040004000040040000444400 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000004444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00444000004004000044440000444000044444000040040004400040040000440440000004400400000000000000000000000000000000000000000000000000 +00404000004004000040040000400000000400000040040000400440040440400044044000440400004444000000000000000000000000000000000000000000 +00444000004044000044440000400000000400000040040000440400040444400004400000040400000004000000000000000000000000000000000000000000 +00400000004444400040400000444400000400000040040000044400040404400044440000004400000040000000000000000000000000000000000000000000 +00400000000004000040040000000400000400000044040000004000004404000440044000004000000400000000000000000000000000000000000000000000 +00400000000000000040040000444400000400000004440000004000004404000000004000044000004444000000000000000000000000000000000000000000 diff --git a/zeldagochi.p8 b/zeldagochi.p8 new file mode 100644 index 0000000..c7332ce --- /dev/null +++ b/zeldagochi.p8 @@ -0,0 +1,518 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ +-- notes about memory layout +--0 is flag if time has +--been set yet + +--1 is the start date i think + +--2 is the start time i think + +--10 and onward gonna use +--for persistent storage of +--the kid stuff + +--10 is the modifier + +function _init() + printh("init") + + cartdata("savedgame") + timeset = dget(0) + stime=dt:new() + + if (timeset==0) then + stime:from(currenttime()) + printh("save:"..stime:tostring()) + stime:save() + else + stime:read() + printh("read:"..stime:tostring()) +-- printh("starttime = ".. ) + end + + cls() +-- printh("goaltime"..goaltime) + m:draw() + ui:draw() + +end + +function _update60() + ctime=dt:new() + m:update() + ctime:from(currenttime()) + if (btn(⬆️)) and + (btn(⬇️)) and + (btn(⬅️)) and + (btn(➡️)) and + (btn(❎)) and + (btn(🅾️)) then + dset(10,0) --reset kid state + dset(0,0) --reset timesaved flag + printh("save reset") + end + + k:update(stime,ctimed) + k:save() + state[stated]:update() +end + +function _draw() + state[stated]:draw() +end +-->8 +p = { --player + s=0, + x=64, + y=64, + w=8, + h=8, + s=1, + xv = 0, + yv = 0, + draw = function(self) + spr(s,self.x,self.y) + end, + input = function(self, xv, yv) + self.xv = xv + self.yv = yv + end, + move = function(self) + if not (hitx(self.x+self.xv,self.y,self.w,self.h)) then + self.x+= self.xv + end + if not (hity(self.x,self.y+self.yv,self.w,self.h)) then + self.y+= self.yv + end + end +} + +k={ --him + s=1, + x=196, + y=64, + m=1, --modifier + t = 0, + growtime=3.600, + update = function(self,start,current) + self.m = dget(10) --get last m + temp = tts() + self.t=temp-self.m + if (self.t<0) then + self.t=0 + self.m=0 + dset(10,self.m) + end + pa = self.t/self.growtime + if (self.t8 +m = { --map + cx=0,--camera x + cy=0,--camera y + --camera velocity + cvx=0, + cvy=0, + --target x and y + tx=0, + ty=0, + t=false,--transition + update= function(self) + tile = (mget(p.x/8,p.y/8)) + f=fget(tile) + if (f>1) then + printh(f) + printh(p.x) + printh(p.y) + self.t = true + if ((f & 0x2)!=0) then + --n + printh("n") + self.cy-=128 + p.y-=16 + elseif ((f&0x4)!=0) then + --e + self.cx+=128 + p.x+=16 + printh("e") + elseif ((f&0x8)!=0) then + --s + printh("s") + self.cy+=128 + p.y+=16 + else + --w + self.cx-=128 + p.x-=16 + printh("oops") + end + else + self.t=false + + end + end, + draw = function(self) + cls() + camera(self.cx,self.cy) + map() + end + +} + + +dt = { + s=0, + m=0, + h=0, + d=0, + mo=0, + y=0, + tostring= + function(self) + return self.s..":" + ..self.m..":" + ..self.h.." " + ..self.d.."-" + ..self.mo.."-" + ..self.y + end, + + from=function(self, obj) + self.s = obj.s + self.m = obj.m + self.h = obj.h + self.d = obj.d + self.mo = obj.mo + self.y = obj.y + end, + save=function(self) +-- dset(1,self:dat()) +-- dset(2,self:tim()) + dset(0,1) + dset(1, self.s) + dset(2, self.m) + dset(3, self.h) + dset(4, self.d) + dset(5, self.mo) + dset(6, self.y) + end, + read=function(self) + self.s=dget(1) + self.m=dget(2) + self.h=dget(3) + self.d=dget(4) + self.mo=dget(5) + self.y=dget(6) + end, + dat=function(self) + return self.y*10+self.mo/10+self.d/1000 + end, + tim=function(self) + return self.h*100+self.m+self.s/100 + end, + tdiff=function(self,obj) + return self:tim()-obj:tim() + end, + ddiff=function(self,obj) + return self:dat()-obj:dat() + end + +} + + +function dt:new(obj) + obj = obj or {} + setmetatable(obj, {__index = self}) + return obj +end +-->8 +-- check hit on top or bottom +function hity(x,y,w,h) --check hit on top or bottom + hit=false + for i=x,x+w do + tile1=mget(i/8,y/8) + tile2=mget(i/8,(y+h)/8) + if (fget(tile1,0)) then + hit=true + elseif (fget(tile2,0)) then + hit=true + end + end + return hit +end +--check hit on sides +function hitx(x,y,w,h) --check hit on sides + hit = false + for i=y,y+h do + tile1=mget(x/8,i/8) + tile2=mget((x+w)/8,i/8) + if (fget(tile1,0)) then + hit=true + elseif (fget(tile2,0)) then + hit=true + end + end + return hit +end + + +-- returns the current time. +--i have to split it up fml +function currenttime() + + t = { + s=stat(95), + m=stat(94), + h=stat(93), + d=stat(92), + mo=stat(91), + y=stat(90) + } + return t +end + +--timetosec +function tts() + temp = (ctime.s-stime.s)/1000 + temp += (ctime.m-stime.m)*.06 + temp += (ctime.h-stime.h)*3.6 + temp += (ctime.d-stime.d)*86.4 + temp += (ctime.mo-stime.mo)*1036.8 + if (temp > 32767.99) + or ((ctime.y-stime.y)>0) + then + stated = 3 --game over + end + + + return temp +end +-->8 +state={ +{--1 menu +update=function(self) +--pause toggle + if (btnp(❎)) then + stated=2 + end +end, +draw=function(self) + ui:draw() + +end +}, +{--2 gameplay +update=function(self) + if (btn(🅾️)) printh(ctime:tostring()) + xv = 0 + yv = 0 + if (btn(➡️)) xv+=p.s + if (btn(⬅️)) xv-=p.s + if (btn(⬆️)) yv-=p.s + if (btn(⬇️)) yv+=p.s + p:input(xv,yv) + p:move() + + + --pause toggle + if (btnp(❎)) then + stated=1 + end +end, + +draw=function(self) + m:draw() + p:draw() + k:draw() +end +}, +{ --3 game over +update=function(self) + +end, +draw=function(self) +cls() +print("you lose... the creature grew too much") +print("hold ⬆️⬇️⬅️➡️❎🅾️ to reset save") +end, +}, +{--4 intro +update=function(self) + if (btnp(❎)) stated=2 +end, +draw=function(self) +cls() +x=rnd(2) +y=rnd(2) +if (timeset==0) then + print("the is growing",0,0,7) + print("creature",x+16,y+1,2) + print("creature",x+16,y,8) + +else + print("the growth never stops",0,0,7) + print("creature's",x+16,y+1,2) + print("creature's",x+16,y,8) + +end +print(" seeks comfort.",0,8,7) +print("it",x,7+y,2) +print("it",x,8+y,8) +print("find .",0,16,7) +print("it",x+18,15+y,2) +print("it",x+18,16+y,8) +print("soothe .",0,24,7) +print("it",x+27,23+y,2) +print("it",x+27,24+y,8) + + +print("pres x to continue",0,80,7) +print(k.t) +end, + +} +} +-->8 + +ui = { + elements={ + kidgrowth={ + text="-his- growth%: ", + x=40, + y=64, + c=7, --color + w=20, + h=20, + draw=function(self) + print(self.text..k.t/k.growtime*100,self.x, self.y, self.c) + end + }, + kidalive={ + text="your kid's been alive for: ", + x=0, + y=4, + c=7, --color + w=20, + h=20, + draw=function(self) + print(self.text,self.x, self.y, self.c) + print(k.t.."s",self.x, self.y+8, self.c) + end + }, + testing={ + text="-his- state: ", + x=40, + y=72, + c=7, --color + w=20, + h=20, + draw=function(self) + print(self.text..k.m,self.x, self.y, self.c) + end + } + }, + draw= function(self) + cls()--clear screen + camera() --reset the camera to default pos + rectfill(0,0,128,128,1) + for k,v in pairs(self.elements) do + v:draw() + end + + end +} +-->8 +--global vars +stated=4 +twodays=172800 +timescale=1 +stime={} +ctime={} +timeset=0 +__gfx__ +00000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000001111110166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000011110001611610166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000110000011610001612610166116610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000110000011110001111110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000011110001211110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000001111110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222555555555555555555555554555555554444444455555555555444445555555544445555000000000000000000000000000000000000000000000000 +2222222256dddd655555555555555554555555555555555555555555555444445555555544445555000000000000000000000000000000000000000000000000 +222222225dddddd55555555555555554555555555555555555555555555444445555555544445555000000000000000000000000000000000000000000000000 +222222225dddddd55555555555555554555555555555555544444555555444445555555544445555000000000000000000000000000000000000000000000000 +222222225dddddd55555555555555554555555555555555544444555555444445554444455555555000000000000000000000000000000000000000000000000 +222222225dddddd55555555555555554555555555555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +2222222256dddd655555555555555554555555555555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +22222222555555555555555555555554444444445555555544444555555555555554444455555555000000000000000000000000000000000000000000000000 +22222222007777002222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222007777002222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222077cc7702211112222111122221111222211112200000000000000000000000000000000000000000000000000000000000000000000000000000000 +2222222207cccc702212212222122122221221222212212200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222077777702212212222122122221221222212212200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222077777702211112222111122221111222211112200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222077777702222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +22222222007777002222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000000000000000000000000 +__gff__ +0000000000000000000000000000000000010101010101010101000000000000000002040810000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__map__ +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111110101010111111111111111111111111111010101011111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111124242424111111111111111111111111112424242411111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111122222222111111111111111111111111112222222211111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111110101010111111111111111111111111111010101011111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010102325101010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101023251010101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111101010101010101010101010111111111010101010101010101010101111111110101010101010101010101011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +__sfx__ +000200000251002510085103a310363202c3201f3300f33039330263302131014420032200b2203042034220184202422016420164200352021520194202e52013520174200c5300742008420014201151000000 +000200000a3200a3200a3200a3200a3200a3200a3100b3100c3100d3100f310113101231015310183101c3201f3201e2202023021230202301f2301e2201c2201b2221a6221762215620146200a6200062000000 +000200000437004370043700437004360043600436004360043600936009360083600837007370063700637006370063700637005370053700537004370043700436004360053700537005370000700000000000