From ff60db72ad0d4130f660c4dd0db25c013edbf4c1 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Fri, 9 Feb 2024 19:50:54 -0800 Subject: [PATCH] breath signal layer might want to make it more subtle later but I'm zonking myself with it for now. can just add a fuzz stage to it if I want. these colors are not final, but I think I do not want to do anything clever with bitplane interference at this time -- this effect is good as-is. --- vacation.p8 | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/vacation.p8 b/vacation.p8 index 7e1e02f..9725293 100644 --- a/vacation.p8 +++ b/vacation.p8 @@ -482,6 +482,76 @@ function fuzzy_stripey:draw() end end + +--@musurca & @felice +function cminskycirc(r,c) + local j,k,rat=r,0,1/r + poke(0x5f25,c) --set color + for i=1,r*0.785 do + k-=rat*j + j+=rat*k + pset(63.5+j,63.5+k) + pset(63.5+j,63.5-k) + pset(63.5-j,63.5+k) + pset(63.5-j,63.5-k) + pset(63.5+k,63.5+j) + pset(63.5+k,63.5-j) + pset(63.5-k,63.5+j) + pset(63.5-k,63.5-j) + end + pset(63.5,63.5-r) + pset(63.5,63.5+r) + pset(63.5-r,63.5) + pset(63.5+r,63.5) +end + +breather = { + colors = {1,2,4,2,1}, + sep = 5, + speed=240, + f=0, +} +mknew(breather) + +function breather:update() + local f = self.f + 1 + if (not self.on) f = 0 + if (f >= self.speed) f = -self.speed + if f == 0 and self.nextspeed then + self.speed = self.nextspeed + self.nextspeed = nil + end + self.f = f +end + +function easeinout(t) + if(t<.5) then + return t*t*t*4 + else + t-=1 + return 1-t*t*t*-4 + end +end + +function breather:draw() + fillp(0) + local cols, f, spd, sep = self.colors, self.f, self.speed, self.sep + local stall = sep * (#cols - 1) + local cap = spd-stall + if (f >= 0) f += stall + for i,c in ipairs(cols) do + local ef = f - (i-1)*sep + ef = abs(ef) - stall + if ef <= cap and ef > 0 then + cminskycirc(easeinout(ef/cap)<<6,c) + end + end +end + +function breather:starting_reverse() + return self.f + self.speed < self.sep * #self.colors +end + -->8 -- awakener @@ -1027,7 +1097,11 @@ function start_game() f = function() pal() clear_alt_pal_bits() - return view.of{bg.new(), fuzzy_stripey.new{interval=7, tries=5}} + return view.of{ + bg.new(), + fuzzy_stripey.new{interval=7, tries=5}, + breather.new{on=true}, + } end, }, }