From 85c322cf5be3efd9113cc047f43c0301287ab2f8 Mon Sep 17 00:00:00 2001 From: James Turk Date: Tue, 7 Mar 2023 19:49:23 -0600 Subject: [PATCH] fixed logo emission --- .gitignore | 1 + yoyodyne.p8 | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 981918b..94b05f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.log +*.p8l demos diff --git a/yoyodyne.p8 b/yoyodyne.p8 index 5fd7437..2c91153 100644 --- a/yoyodyne.p8 +++ b/yoyodyne.p8 @@ -28,7 +28,7 @@ yyl = { vx = 0, vy = -1, done = false, - maxt = 60, + maxt = 20, } function dist(x1, y1, x2, y2) @@ -82,6 +82,7 @@ function yyl:chk_stop(p) -- round to nearest whole seq = 128*flr(p.y+0.5) + flr(p.x+0.5) if self.filled[seq] == p.c then + p.vx = 0 p.vy = 0 p.x = flr(p.x+0.5) p.y = flr(p.y+0.5) @@ -100,7 +101,7 @@ function yyl:fill_it_in() for i,c in pairs(self.filled) do y = flr(i/128) x = i-(128*y) - add(self.ps, {x=x, y=y, c=c, vy=0,vx=0}) + add(self.ps, {x=x,y=y,c=c,vy=0,vx=0}) end self.done = true end @@ -111,8 +112,8 @@ function yyl:update() for c in all{8, 11, 12} do add(self.ps, {x=self.ex, y=self.ey, c=c, - vy=rnd(2)+2*self.vy, - vx=rnd(2)+2*self.vx} + vy=(rnd(2)+1)*self.vy, + vx=(rnd(2)+1)*self.vx} ) end @@ -122,16 +123,28 @@ function yyl:update() end -- move emitter - if self.ex < 128 then + if self.ey == 128 and self.ex < 128 then self.ex += 1 - elseif self.ex == 128 then + self.vx = 0 + self.vy = -1 + elseif self.ex == 128 and self.ey > 0 then + self.ey -= 1 + self.vx = -1 + self.vy = 0 + elseif self.ey == 0 and self.ex > 0 then + self.ex -= 1 + self.vx = 0 + self.vy = 1 + else self.ey += 1 + self.vx = 1 + self.vy = 0 end end -- update pixels for i, p in pairs(self.ps) do - if p.vy > 0 then + if p.vy != 0 or p.vx != 0 then p.x += p.vx p.y += p.vy self:chk_stop(p)