re-explode

This commit is contained in:
James Turk 2023-04-25 22:22:29 -05:00
parent 43e9c5b16f
commit c397984e8e

View File

@ -269,6 +269,7 @@ function explosion_adjacent(x, y)
end
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)
@ -300,10 +301,9 @@ function update_level()
-- update grid
fall_speed = 0.3
if exploding then
fall_speed /= 2
if bomb_spr.speed == 0 and bomb_spr.anim then
bomb_spr.anim = nil
puzzle_grid[bomb_y][bomb_x] = 0
exploding = false
bomb_spr.frame = 0
end
end
if t() - last_gravity > fall_speed then
@ -329,14 +329,16 @@ function update_level()
end
end
update_sprite(bomb_spr)
update_explosions()
if exploding then
update_sprite(bomb_spr)
if bomb_spr.frame > 10 and bomb_spr.anim then
-- when explosion hits last frame, particles / update grid
add_explosion(bomb_x, bomb_y)
puzzle_grid[bomb_y][bomb_x] = GRID_EXPLODE
end
update_explosions()
-- exploding means we're done
-- exploding means we're done before input comes
return
end
@ -368,7 +370,6 @@ end
function explode()
exploding = true
explosion_time = t()
bomb_spr.speed = 0.1
end