new block types, loading map

This commit is contained in:
James Turk 2023-04-25 03:07:15 -05:00
parent 60d022c663
commit 31aef6525c

View File

@ -8,7 +8,7 @@ __lua__
function _init()
palt(11, true)
palt(0, false)
start_level(1)
start_level(2)
end
function _update()
@ -135,23 +135,26 @@ function start_explainer()
exp_phase = "boy"
end
levels = {
{name="lobby", mapx=16, mapy=8, bomb_x=6, bomb_y=7},
{name="lab", mapx=26, mapy=8, bomb_x=6, bomb_y=7},
}
function start_level(n)
start_scene("level")
last_gravity = t()
exploding = false
puzzle_grid = {
{137, 0, 0, 0, 0, 0, 0, 0},
{137, 137, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 137},
{0, 0, 0, 0, 0, 0, 0, 137},
{0, 0, 137, 0, 0, 137, 137, 137},
{137, 137, 137, 137, 137, 137, 137, 137},
}
bomb_x = 7
bomb_y = 7
level = levels[n]
puzzle_grid = {}
for y=1,GRID_H do
printh(y)
puzzle_grid[y] = {0, 0, 0, 0, 0, 0, 0, 0}
for x=1,GRID_W do
puzzle_grid[y][x] = mget(x+level.mapx-1, y+level.mapy-1)
end
end
bomb_x = level.bomb_x
bomb_y = level.bomb_y
bomb_spr = make_sprite(bomb_x*8, bomb_y*8, "bomb_s", 0)
end
@ -167,7 +170,7 @@ function draw_level()
end
end
print(" lobby", 90, 6)
print(level.name, 90, 6)
bomb_spr.x = bomb_x * 8
bomb_spr.y = bomb_y * 8
@ -214,12 +217,18 @@ function update_level()
if x < GRID_W and puzzle_grid[y][x+1] == GRID_BOX then
puzzle_grid[y][x+1] = GRID_EXPLODE
end
puzzle_grid[y][x] = 0
--puzzle_grid[y][x] = 0
end
-- fall down
if y < GRID_H and puzzle_grid[y+1][x] == 0 then
if y < GRID_H
and puzzle_grid[y][x] == GRID_BOX
and puzzle_grid[y+1][x] == 0 then
puzzle_grid[y+1][x] = puzzle_grid[y][x]
puzzle_grid[y][x] = 0
if y+1 == bomb_y and x == bomb_x then
explode()
puzzle_grid[y+1][x] = 0
end
end
end
end
@ -353,14 +362,14 @@ cc77cc77bbbb55555555bbbbbbbbbbbb555555555654456555444455c4ffff47c5665657c53ea157
77cc77ccbbbb55555555bbbb55555555bbbbbbbb55555555b544445b74ffff4c7566555c7555555c7444444c74363f4c55555555000000000000000000000000
cc77cc77bbbb55555555bbbb55555555bbbbbbbbb556655bbbbbbbbbc4ffff47c5555557c5555557c4444447c4363f4755555555000000000000000000000000
cc77cc77bbbb55555555bbbb55555555bbbbbbbb6b5555b6bbbbbbbbc4444447cc77cc77cc77cc77cc444477c4444447c5555557000000000000000000000000
bbbbbbbbbbbbbbbbbb8888bbbbbbbbbbbbbbbbbb444bbbb4444888bbbbbbbbbb0000000044444444000000000000000000000000000000000000000000000000
bbbbbbbbbbbbbbbbb8888bbbbbbbbbbbbbbbb447774bbbb4ee44444444bbbbbb0000000044ffff44000000000000000000000000000000000000000000000000
bbb88bb88bb888bb88bb5bbb888bbbbbbbb44ee747488bb777e47474448bbbbb000000004f4ff4f4000000000000000000000000000000000000000000000000
bbb888b88b88888b88888bb88888bbbbbbb844e777748b874744747e4488bbbb000000004ff44ff4000000000000000000000000000000000000000000000000
bbb888888b88b88bbbbb88b88b88bbbbbbb884e74d74b887774447e44488bbbb000000004ff44ff4000000000000000000000000000000000000000000000000
bbb88b888b88888bb88888b88888bbbbbbb884477774b84444e77444448bbbbb000000004f4ff4f4000000000000000000000000000000000000000000000000
bbb88bb88b88b88b88885bb88b88bbbbbbb88b448b88b844444444b88bbbbbbb0000000044ffff44000000000000000000000000000000000000000000000000
bbb5bbb5bb5bbb5bbb5b5bb5bbb5bbbbbbb5bbb5bb5bbb5bbb5b5bb5bbb5bbbb0000000044444444000000000000000000000000000000000000000000000000
bbbbbbbbbbbbbbbbbb8888bbbbbbbbbbbbbbbbbb444bbbb4444888bbbbbbbbbb0000000044444444555555554444444455555555555555555555555500000000
bbbbbbbbbbbbbbbbb8888bbbbbbbbbbbbbbbb447774bbbb4ee44444444bbbbbb0000000044ffff4455dddd55449999445577775550aaaa055cccccc500000000
bbb88bb88bb888bb88bb5bbb888bbbbbbbb44ee747488bb777e47474448bbbbb000000004f4ff4f45d5dd5d54989989457373775500aa0055111ccc500000000
bbb888b88b88888b88888bb88888bbbbbbb844e777748b874744747e4488bbbb000000004ff44ff45dd55dd549988994577bb37550a00a05511111c500000000
bbb888888b88b88bbbbb88b88b88bbbbbbb884e74d74b887774447e44488bbbb000000004ff44ff45dd55dd549988994577bb3755aa00aa55cc1111500000000
bbb88b888b88888bb88888b88888bbbbbbb884477774b84444e77444448bbbbb000000004f4ff4f45d5dd5d549899894573737755a0000a55ccc111500000000
bbb88bb88b88b88b88885bb88b88bbbbbbb88b448b88b844444444b88bbbbbbb0000000044ffff4455dddd554499994455777755500000055cccccc500000000
bbb5bbb5bb5bbb5bbb5b5bb5bbb5bbbbbbb5bbb5bb5bbb5bbb5b5bb5bbb5bbbb0000000044444444555555554444444455555555555555555555555500000000
bb6666666666666666666666666666bbbb666666666666666666666666b5bbbb0000000000000000000000000000000000000000000000000000000000000000
bb66c6c6c6c6c6c66c6c6c6c6c6c66bbbb666666666666666666666666665bbb0000000000000000000000000000000000000000000000000000000000000000
bb66c6c6c6c6c6c66c6c6c6c6c6c66bbbb66c646c6c6c6c6646c6c6c6b6b6bbb0000000000000000000000000000000000000000000000000000000000000000
@ -418,15 +427,15 @@ __map__
b2b2b2b2b2b2b2b2b2b8b8b8b8b8b8b80000000000b8b8b8b8b8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
b2b2b2b2b2b2b2b2b2b0b0b0b0b0b0b00000000000b0b0b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
c0c1c1c1c1c1c1c1c1c2c3c4c4c4c4c500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2e3e4e4e4e4e500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2c3c4c4c4c4c500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000800d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300001800d50000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d50000000000001a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
c0c1c1c1c1c1c1c1c1c2c3c4c4c4c4c58b8900000000000000008c00000000008d8d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2e3e4e4e4e4e589000000000000000000890000000000898900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2c3c4c4c4c4c500000000000000000000890000000000898900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000890000000000898900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000800d500000000000000008900890000000000898900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300001800d500000000000000008b00890000000000898900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5000000000000008b8900890000000000898900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d58900000000008b898b00890000000000898900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d5898b89000089898b89008b8b8b8b8b8b8b8b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
d0d1d1d1d1d1d1d1d1d2d300000000d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
e0e1e1e1e1e1e1e1e1e2e3e4e4e4e4e500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
c3c4c4c4c4c4c4c4c4c4c4c4c4c4c4c500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000