change particle energy

This commit is contained in:
James Turk 2023-04-25 22:30:30 -05:00
parent c397984e8e
commit f91b940b5d

View File

@ -192,7 +192,7 @@ function add_explosion(gx, gy)
x=x, y=y,
vx=(rnd(1)+1)*cos(angle),
vy=(rnd(1)+1)*sin(angle),
age=rnd(5),
age=30+rnd(10),
})
end
end
@ -208,19 +208,19 @@ function update_explosions()
local p = particles[i]
p.x += p.vx
p.y += p.vy
p.age += 1
if p.age > 25 then
p.age -= 1
if p.age <= 0 then
deli(particles, i)
elseif p.age > 20 then
p.color = 10
elseif p.age > 15 then
p.color = rnd({9, 10})
elseif p.age > 10 then
p.color = 9
elseif p.age > 5 then
p.color = rnd({8, 9})
else
elseif p.age > 40 then
p.color = 8
elseif p.age > 30 then
p.color = rnd({8, 9})
elseif p.age > 20 then
p.color = 9
elseif p.age > 10 then
p.color = rnd({9, 10})
elseif p.age > 5 then
p.color = 10
end
end
end
@ -304,6 +304,7 @@ function update_level()
if bomb_spr.speed == 0 and bomb_spr.anim then
exploding = false
bomb_spr.frame = 0
bomb_y = 0
end
end
if t() - last_gravity > fall_speed then
@ -363,7 +364,7 @@ function update_level()
explode()
end
-- fall immediately
while bomb_y < GRID_H and puzzle_grid[bomb_y+1][bomb_x] == 0 do
if bomb_y < GRID_H and puzzle_grid[bomb_y+1][bomb_x] == 0 then
bomb_y += 1
end
end