From c397984e8e263c6406798a0778496102c832b52a Mon Sep 17 00:00:00 2001 From: James Turk Date: Tue, 25 Apr 2023 22:22:29 -0500 Subject: [PATCH] re-explode --- games/boybomb.p8 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/games/boybomb.p8 b/games/boybomb.p8 index df053c7..7f59398 100644 --- a/games/boybomb.p8 +++ b/games/boybomb.p8 @@ -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