movement wip

This commit is contained in:
James Turk 2023-05-03 00:55:51 -05:00
parent 5061d7f6a1
commit a10945a215

View File

@ -66,6 +66,8 @@ function start_level()
walls[90]={{0,10}, {25,30}, {38,44}}
the_line = 64
spr_frame = 1
floor = 0
jump_time = 0
end
function draw_side(right)
@ -81,15 +83,24 @@ function draw_side(right)
end
function draw_level()
--palt(0, false)
-- left side
cls(0)
draw_side(false)
spr(spr_frame, the_line-8, 120, 1, 1, false)
spr(spr_frame, the_line-8, 120-floor, 1, 1, false)
rectfill(the_line, 0, 128, 128, LIGHT)
-- right side
draw_side(true)
pal({[LIGHT]=DARK})
spr(spr_frame, the_line, 120, 1, 1, true)
spr(spr_frame, the_line, 120-floor, 1, 1, true)
pal()
-- floor
rectfill(0, 128-floor, the_line, 129-floor, LIGHT)
rectfill(the_line, 128-floor, 128, 129-floor, DARK)
fillp(0b1000010000100001)
rectfill(0, 130-floor, the_line, 128, LIGHT)
fillp(0b0111101111011110)
rectfill(the_line, 130-floor, 128, 128, LIGHT)
fillp()
end
function update_level()
@ -97,12 +108,24 @@ function update_level()
if spr_frame >= 4 then
spr_frame = 1
end
if btn(0) then
the_line -= 1
floor += 0.2
-- No button pressed: <
-- Right button pressed: |
-- Jump: <<
-- Jump & Right: >
local dx = -0.25
if btnp(4) then
jump_time = t()
end
if btn(1) then
the_line += 1
dx += 0.25
if t() - jump_time < 1 then
dx += 0.25
end
end
the_line += dx
end
LIGHT = 6