From e69ae6f37e9aba858c769b32313e68ecb245bdd0 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sat, 10 Feb 2024 17:23:17 -0800 Subject: [PATCH] zonk palettes, text sproing not sure why breather isn't rendering --- vacation.p8 | 100 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 16 deletions(-) diff --git a/vacation.p8 b/vacation.p8 index 6d51f75..0aa3d6b 100644 --- a/vacation.p8 +++ b/vacation.p8 @@ -308,7 +308,6 @@ end txtbox = { x=0, y=0, - cols={14, 10, 9, 8}, f=0, interval=4, mode=0x81, @@ -420,6 +419,49 @@ function scootbox:draw() return self.v:draw() end +nrm_txt_pal = split"14,10,9,8" +sfd_txt_pal = split"15,10,9,8" +hlt_txt_pal = split"13,11,9,8" +shd_txt_pal = split"12,12,1,0" + +function cparr(t) + local ret = {} + for i,x in ipairs(t) do + ret[i]=x + end + return ret +end + +function zonk_txt(s, x, y, p, md, amt, frms) + md = md or 0x80 + frms = frms or 0 + amt = amt or 0 + local itv = (frms>>2)&0x7ff + local v = view.of{ + txtbox.new{ + x=x+1, + y=y+1, + interval=itv, + cols=cparr(shd_txt_pal), + mode=md, + text=s, + }, + txtbox.new{ + x=x, + y=y, + interval=itv, + cols=cparr(p), + mode=md, + text=s, + }, + } + return spring.new{ + from=-amt, + frames=frms, + v=v, + } +end + -->8 -- zonk renderer @@ -496,7 +538,7 @@ fuzzy_stripey = { weight = 12, spacing = 7, gap = 32, - colors = {5, 2, 1}, + colors = split"3,5,2,1", } mknew(fuzzy_stripey, function(f) f.fuzz = fuzzy.new{ @@ -546,8 +588,10 @@ function cminskycirc(r,c) pset(63.5+r,63.5) end +obvious_breather=split"2,3,4,3,2" +bg_breather=split"1,2,4,2,1" breather = { - colors = {1,2,4,2,1}, + colors = obvious_breather, sep = 8, speed=240, f=0, @@ -594,6 +638,39 @@ function breather:starting_reverse() return self.f + self.speed < self.sep * #self.colors end +def_z_pal = { + [0]=0,129,1,2,4,5,6,7,1,5,6,140,2,13,7,7 +} +def_14_fade = split"0,128,129,133,141,13,6,15,135,7" +def_15_fade = split"0,128,129,133,141,13,13,6,6,15,15,136,135,7" +def_13_fade = split"0,128,129,133,141,140,140,13,13,12" +def_shd_fade = split"0,128,130,141,2" + +zonk_mode = {} +mknew(zonk_mode, function(self) + self.stripes=fuzzy_stripey.new{} + self.brth=breather.new{} + -- test renderer + clear_alt_pal_bits() + pal() + pal(self.p or def_z_pal, 1) + self.brth.go = true + self.txtwnd = zonk_txt("tEXT tEST", 40, 60, nrm_txt_pal, 0x81, 32, 30) +end) + +function zonk_mode:update() + self.stripes:update() + self.brth:update() + self.txtwnd:update() +end + +function zonk_mode:draw() + cls(0) + self.stripes:draw() + self.brth:draw() + self.txtwnd:draw() +end + -->8 -- awakener @@ -936,7 +1013,8 @@ function toyphin:draw() spr(st.s[1+(((t()<<1)&0x0.FFFF*#st.s)&0x7FFF)], self.x + st.xo, y + st.yo, self.state.ws, self.state.hs) end --->8 word target +-->8 +-- arcade mode wordtarget = { x = 129, @@ -973,9 +1051,6 @@ function wordtarget:draw() print(self.str, self.x, self.y, 0x100a) end --->8 --- arcade mode - -- palette use: -- 0: shallow sea blue (1) -- 1: black (for sprites) @@ -1240,15 +1315,8 @@ function start_game() -- }} -- }, { - f = function() - pal() - clear_alt_pal_bits() - return view.of{ - bg.new(), - fuzzy_stripey.new{interval=7, tries=5}, - breather.new{on=true}, - } - end, + f = zonk_mode.new, + params={}, }, } seq:next()