From dd34ad0a373106191b0b1831ecd48521a6aae997 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Thu, 29 Feb 2024 21:19:26 -0800 Subject: [PATCH] by Pyrex: cloud animation prototype --- clouds3.p8 | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 clouds3.p8 diff --git a/clouds3.p8 b/clouds3.p8 new file mode 100644 index 0000000..d69c74e --- /dev/null +++ b/clouds3.p8 @@ -0,0 +1,124 @@ +pico-8 cartridge // http://www.pico-8.com +version 42 +__lua__ + +function _init() + cmgr0=cloud_manager:new(15,51,5,1,5,13) + cmgr1=cloud_manager:new(12,51-8,7,4,13,6) + cmgr2=cloud_manager:new(6,51-14,9,3,15,7) + cmgr0.step=5 + cmgr1.step=4 + cmgr2.step=3 + last_x=0 + x=0 + dx=0 +end + + +function _update60() + if (btn(4)) dx+=1.0 + dx*=0.75 + x+=dx + while last_x0) add(clouds2,c) + end + self.clouds=clouds2 + end +end + +function cloud_manager:draw() + local r0=96 + local r1=96+16 + local h=self.h+self.oval_h+1 + assert(h<=16) + + -- render to spritesheet + poke(0x5f55,0x00) + rectfill(0,r0,127,r0+h,0) + + -- use bitplanes + for c in all(self.clouds) do + poke(0x5f5e,c.plane) + ovalfill(c.x,r0+c.y,c.x+c.w,r0+c.y+self.oval_h,15) + end + poke(0x5f5e,255) + + -- render from high memory + -- to higher memory + rectfill(0,r1,127,r1+h,0) + + for i in all(split"0,1,2,4,8") do + palt(i,true) + end + for i=0,15 do + pal(i,7) + end + + poke(0x5f5e,0xf1) + sspr(0,r0,128,h,0,r1) + poke(0x5f5e,0xf2) + sspr(0,r0,128,h,1,r1+1) + sspr(0,r0,128,h,5,r1+1) + poke(0x5f5e,255) + + -- render to screen + poke(0x5f55,0x60) + pal() + pal(1,self.c1) + pal(2,self.c0) + pal(3,self.c1) + sspr(0,r1,128,h,0,self.y) + pal() +end + +__gfx__ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000