explode materials
This commit is contained in:
parent
b75c5f7c16
commit
9348186d6d
@ -183,7 +183,7 @@ function start_level(n)
|
||||
end
|
||||
|
||||
particles = {}
|
||||
function add_explosion(gx, gy)
|
||||
function add_explosion(gx, gy, colors)
|
||||
sfx(0)
|
||||
local x = gx*8+4
|
||||
local y = gy*8+4
|
||||
@ -193,7 +193,8 @@ function add_explosion(gx, gy)
|
||||
x=x, y=y,
|
||||
vx=(rnd(1)+1)*cos(angle),
|
||||
vy=(rnd(1)+1)*sin(angle),
|
||||
age=30+rnd(10),
|
||||
age=10+rnd(10),
|
||||
color=rnd(colors),
|
||||
})
|
||||
end
|
||||
end
|
||||
@ -212,16 +213,6 @@ function update_explosions()
|
||||
p.age -= 1
|
||||
if p.age <= 0 then
|
||||
deli(particles, i)
|
||||
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
|
||||
@ -273,7 +264,7 @@ function process_block(x, y)
|
||||
-- called on each block each frame
|
||||
local block = puzzle_grid[y][x]
|
||||
if block == GRID_EXPLODE_NEXT then
|
||||
add_explosion(x, y)
|
||||
add_explosion(x, y, {4, 15}) -- wood
|
||||
puzzle_grid[y][x] = GRID_EXPLODE
|
||||
elseif block == GRID_EXPLODE then
|
||||
if y > 1 then
|
||||
@ -310,7 +301,7 @@ function update_level()
|
||||
end
|
||||
if t() - last_gravity > fall_speed then
|
||||
last_gravity = t()
|
||||
for y=1,GRID_H do
|
||||
for y=GRID_H,1,-1 do
|
||||
for x=1,GRID_W do
|
||||
process_block(x, y)
|
||||
-- fall down
|
||||
@ -337,7 +328,7 @@ function update_level()
|
||||
if exploding then
|
||||
if bomb_spr.frame > 10 and bomb_spr.anim then
|
||||
-- when explosion hits last frame, particles / update grid
|
||||
add_explosion(bomb_x, bomb_y)
|
||||
add_explosion(bomb_x, bomb_y, {8, 9, 10})
|
||||
puzzle_grid[bomb_y][bomb_x] = GRID_EXPLODE
|
||||
end
|
||||
-- exploding means we're done before input comes
|
||||
|
Loading…
Reference in New Issue
Block a user