re-explode
This commit is contained in:
parent
43e9c5b16f
commit
c397984e8e
@ -269,6 +269,7 @@ function explosion_adjacent(x, y)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function process_block(x, y)
|
function process_block(x, y)
|
||||||
|
-- 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)
|
||||||
@ -300,10 +301,9 @@ function update_level()
|
|||||||
-- update grid
|
-- update grid
|
||||||
fall_speed = 0.3
|
fall_speed = 0.3
|
||||||
if exploding then
|
if exploding then
|
||||||
fall_speed /= 2
|
|
||||||
if bomb_spr.speed == 0 and bomb_spr.anim then
|
if bomb_spr.speed == 0 and bomb_spr.anim then
|
||||||
bomb_spr.anim = nil
|
exploding = false
|
||||||
puzzle_grid[bomb_y][bomb_x] = 0
|
bomb_spr.frame = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if t() - last_gravity > fall_speed then
|
if t() - last_gravity > fall_speed then
|
||||||
@ -329,14 +329,16 @@ function update_level()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
update_sprite(bomb_spr)
|
||||||
|
update_explosions()
|
||||||
|
|
||||||
if exploding then
|
if exploding then
|
||||||
update_sprite(bomb_spr)
|
|
||||||
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
|
||||||
add_explosion(bomb_x, bomb_y)
|
add_explosion(bomb_x, bomb_y)
|
||||||
puzzle_grid[bomb_y][bomb_x] = GRID_EXPLODE
|
puzzle_grid[bomb_y][bomb_x] = GRID_EXPLODE
|
||||||
end
|
end
|
||||||
update_explosions()
|
-- exploding means we're done before input comes
|
||||||
-- exploding means we're done
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -368,7 +370,6 @@ end
|
|||||||
|
|
||||||
function explode()
|
function explode()
|
||||||
exploding = true
|
exploding = true
|
||||||
explosion_time = t()
|
|
||||||
bomb_spr.speed = 0.1
|
bomb_spr.speed = 0.1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user