fixed logo emission

This commit is contained in:
James Turk 2023-03-07 19:49:23 -06:00
parent 2f98a2fa26
commit 85c322cf5b
2 changed files with 21 additions and 7 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.log
*.p8l
demos

View File

@ -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)