From 304480553f38ddfacb1fab2ff9a219b1b5d31bb0 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sun, 11 Feb 2024 12:57:15 -0800 Subject: [PATCH] spark animation --- vacation.p8 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/vacation.p8 b/vacation.p8 index a9d4ff8..87d77ca 100644 --- a/vacation.p8 +++ b/vacation.p8 @@ -1297,7 +1297,7 @@ end -- 1: black (for sprites) -- 2: dolphin shading -- 3: azure water, maybe score display? (140) --- 4, 5: unassigned, layer-specific +-- 4, 5: keep default in sky layer (for emergency awakener) -- 6: dolphin specular highlights -- 7: dolphin white paint -- 8, 9: unassigned, layer specific @@ -1370,6 +1370,24 @@ function sea:draw() rectfill(0, 125+(w>>3), 128, 128, 0x1001) end +spark = { + x=0, + y=0, + dx=0, + dy=0, + f=-1, +} +mknew(spark) +function spark:update() + self.f += 1 + if (self.f >= 12) return true + self.x += self.dx + self.y += self.dy +end +function spark:draw() + spr(48+self.f\2, self.x, self.y) +end + arcade_level = { score=0, max_score=999, @@ -1455,7 +1473,8 @@ end function arcade_level:word_hit(word) self.score += 1 -- TODO: sfx - -- TODO: sparkle + self.bg:push_back(spark.new{x=word.x-1, y=word.y-1, dx=-2}) + self.bg:push_back(spark.new{x=word.x+word.w, y=word.y-1, dx=1}) end function arcade_level:draw()