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