crush line
This commit is contained in:
parent
d368be4d7c
commit
61029569c7
@ -57,10 +57,10 @@ end
|
||||
|
||||
function start_level()
|
||||
walls = {}
|
||||
walls[30]={{0,10}, {25,30}, {38,44}}
|
||||
walls[50]={{5,10}, {20,30}, {45,55}}
|
||||
walls[70]={{0,10}, {20,30}, {44,55}}
|
||||
walls[90]={{0,10}, {25,30}, {38,44}}
|
||||
walls[30]={{0,20}}
|
||||
walls[50]={{20,60}}
|
||||
walls[70]={{90, 120}}
|
||||
walls[90]={{10, 40}, {80, 100}}
|
||||
the_line = 64
|
||||
spr_frame = 1
|
||||
opp_frame = 1
|
||||
@ -86,10 +86,11 @@ end
|
||||
function collide_platforms()
|
||||
local left = the_line - 6
|
||||
local right = the_line + 6
|
||||
local py = 128-floor
|
||||
for y, platforms in pairs(walls) do
|
||||
for plat in all(platforms) do
|
||||
-- check if there's a platform at this level
|
||||
if floor > y and floor - y < 8 then
|
||||
if py > y and py - y < 8 then
|
||||
-- check if either edge of player+opp is between edges
|
||||
if (left > plat[1] and left < plat[2]) or (right > plat[1] and right < plat[2]) then
|
||||
printh("xcol "..(the_line-6).." "..plat[1].."-"..plat[2])
|
||||
@ -101,10 +102,19 @@ function collide_platforms()
|
||||
end
|
||||
|
||||
function draw_player()
|
||||
if crush_line then
|
||||
local squash_h = 8-(crush_line - (120-floor))
|
||||
printh(crush_line.." "..(120-floor))
|
||||
sspr(40, 0, 8, 8, the_line-8, crush_line, 8, squash_h, false)
|
||||
pal({[LIGHT]=DARK})
|
||||
sspr(40, 0, 8, 8, the_line, crush_line, 8, squash_h, true)
|
||||
pal()
|
||||
else
|
||||
spr(spr_frame, the_line-8, 120-floor, 1, 1, false)
|
||||
pal({[LIGHT]=DARK})
|
||||
spr(opp_frame, the_line, 120-floor, 1, 1, true)
|
||||
pal()
|
||||
end
|
||||
end
|
||||
|
||||
function draw_level()
|
||||
@ -152,7 +162,9 @@ function update_level()
|
||||
the_line += dx
|
||||
|
||||
-- collision
|
||||
if not crush_line then
|
||||
collide_platforms()
|
||||
end
|
||||
|
||||
-- player frames:
|
||||
-- still: 1
|
||||
|
Loading…
Reference in New Issue
Block a user