buncha levels

This commit is contained in:
James Turk 2023-04-30 05:22:08 -05:00
parent d92817820a
commit a50055ba4f

View File

@ -176,10 +176,22 @@ levels = {
mapx=39, mapy=8, par=2, boss=8,
message="being hit by a block\nwill make him explode"
},
{name=" lab 1",
mapx=48, mapy=8, par=2, boss=8,
{name=" lab 1",
mapx=48, mapy=8, par=2, boss=11,
message="we need to be careful\nof chain reactions",
}
},
{name=" lab 2",
mapx=56, mapy=8, par=2, boss=11,
message="there's no way!",
},
{name=" lab 3",
mapx=63, mapy=8, par=2, boss=11,
message="we may need to evacuate...",
},
{name=" lab 4",
mapx=72, mapy=8, par=2, boss=11,
message="ok, fall back!",
},
}
function start_level(n)
start_scene("level")
@ -298,9 +310,9 @@ function explosion_adjacent(x, y)
-- called when the block next door explodes
local block = puzzle_grid[y][x]
if block == BOX_WOOD then
add_explosion(x, y, 1, explosion_types.wood)
add_explosion(x, y, 3, explosion_types.wood)
elseif block == BOX_FIRE then
-- TODO: add explosion
add_explosion(x, y, 3, explosion_types.fire)
end
end
@ -353,24 +365,47 @@ end
function update_level()
-- explosions
-- decrement explosions in separate loop to avoid issues with chains
for x=1,GRID_W do
for y=1,GRID_H do
local exp = explode_grid[y][x]
if exp then
exp.countdown -= 1
end
end
end
-- track if any explosions this frame
for x=1,GRID_W do
for y=1,GRID_H do
update_exp_grid(x, y)
end
end
update_sprite(bomb_spr)
update_explosions()
-- bomb animation / explosion
if bomb_spr.frame > 1 then
if bomb_spr.is_done then
-- when explosion hits last frame, particles / update grid
reset_sprite(bomb_spr)
bomb_y = 1
end
end
-- explosion in progress
if #particles > 1 then
return
end
-- gravity
fall_speed = 0.3
if t() - last_gravity > fall_speed then
last_gravity = t()
-- decrement explosions in separate loop to avoid
-- issues with chains
for x=1,GRID_W do
for y=1,GRID_H do
local exp = explode_grid[y][x]
if exp then
exp.countdown -= 1
end
end
end
for y=GRID_H,1,-1 do
for x=1,GRID_W do
update_exp_grid(x, y)
-- fall down
if y < GRID_H
and puzzle_grid[y+1][x] == 0
@ -389,20 +424,6 @@ function update_level()
end
end
update_sprite(bomb_spr)
update_explosions()
-- bomb animation / explosion
if bomb_spr.frame > 1 then
if bomb_spr.is_done then
-- when explosion hits last frame, particles / update grid
reset_sprite(bomb_spr)
bomb_y = 0
end
-- exploding means we're done before input comes
return
end
-- movement
if btnp(⬅️) then
if can_move(-1, 0) then
@ -429,7 +450,6 @@ function update_level()
bomb_y += 1
end
-- DEBUG LEVEL SELECT
if btnp(⬇️) then
level_num = max(level_num-1, 1)
@ -443,7 +463,7 @@ end
function explode()
bomb_spr.speed = 0.1
add_explosion(bomb_x, bomb_y, 4, explosion_types.fire)
add_explosion(bomb_x, bomb_y, 40, explosion_types.fire)
level_dets += 1
end
@ -740,17 +760,17 @@ __map__
b2b2b2b2b2b2b2b2b2b8b8b8b8b8b8b80000000000b8b8b8b8b8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
b2b2b2b2b2b2b2b2b2b0b0b0b0b0b0b00000000000b0b0b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
c0c1c1c1c1c1c1c1c1c2c3c4c4c4c4c588888888888888880000888888888888888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2e3e4e4e4e4e500000000000000000000880088888888888889008900000000890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2c3c4c4c4c4c500000000000000000000880088888888888889988900008989890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000888888888888888889898900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000880000008888888889898900008888880000880000008800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000880000000000888889898900008888888800888888008800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000880000000000888889898900000000000000000000008800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d588888888888888880000880000000000888889898900000000000000000000008800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d588888988898888880089889888888988888889898900000000000000000000008889000000890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5888889988988888800898889888889008888898989000089000088880000890088898b008b890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d3d4d4d4d4d588888989898888880089898989898988888889898900008989898888898989008889898989890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
c0c1c1c1c1c1c1c1c1c2c3c4c4c4c4c5888888888888888800008888888888888888000000000000000000000000000000000000000000008b8b8b8b8b8b8b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2e3e4e4e4e4e5000000000000000000008800888888888888890089000000008900000000000000000000000000008b8b8b8b8b8b8b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2c3c4c4c4c4c5000000000000000000008800888888888888899889000089898900000000000000000000000000008b8989898989890000000000000000000000009800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5000000000000000000008888888888888888898989000000000000000000000000000000000000008b8989898989890000000000000000000000898989890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5000000000000000000008800000088888888898989000088888800008800000088000000000000008b8b8b8b8b8b8b0000000000000000000000898b8b890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5000000000000000000008800000000008888898989000088888888008888880088000000000000008989898989898b00000000000089890000008b8b8b8b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5000000000000000000008800000000008888898989000000000000000000000088000000000000008989898989898b000000000089898b0000008b8b8b8b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5888888888888888800008800000000008888898989000000000000000000000088000000000000008b8b8b8b8b8b8b0000000089898b8b00898989898b8b8b8b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5888889888988888800898898888889888888898989000000000000000000000088890000008900008b898989898989000000898b8b898900898b8b8b8b89898b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5888889988988888800898889888889008888898989000089000088880000890088898b008b8900008b898989898989000089898b898b8900898b8b8b8b89898b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d3d4d4d4d4d5888889898988888800898989898989888888898989000089898988888989890088898989898900008b8b8b8b8b8b8b988b898b8b89898b00898989898b8b8b8b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d3d4d4d4d4d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
e0e1e1e1e1e1e1e1e1e2e3e4e4e4e4e500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
c3c4c4c4c4c4c4c4c4c4c4c4c4c4c4c500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000