add more ramps, make lever move the other way, misc things

This commit is contained in:
Colin McMillen 2021-06-10 19:51:28 -04:00
parent c8235dea59
commit bdd5133211

View File

@ -38,7 +38,7 @@ end
function init_world() function init_world()
player = {} player = {}
player.x = 64 player.x = 36
player.y = 16 player.y = 16
player.spr = 1 player.spr = 1
@ -46,6 +46,8 @@ function init_world()
ramps = {} ramps = {}
levers = {} levers = {}
add_ramp(70,25,40,-5)
add_ramp(50,20,15,10) add_ramp(50,20,15,10)
add_ramp(60,50,15,-15) add_ramp(60,50,15,-15)
add_ramp(52,60,14,0) add_ramp(52,60,14,0)
@ -79,7 +81,7 @@ end
function _update() function _update()
update_player() update_player()
update_drops() update_drops()
update_levers() foreach(levers, update_lever)
end end
function update_player() function update_player()
@ -95,10 +97,8 @@ function update_player()
if btn(3) then if btn(3) then
player.y += 1 player.y += 1
end end
if (player.y < 0) player.y = 0 player.x = mid(0, player.x, 127)
if (player.y > 127) player.y = 127 player.y = mid(0, player.y, 127)
if (player.x < 0) player.x = 0
if (player.x > 127) player.x = 127
if btnp(🅾️) then if btnp(🅾️) then
drop = {} drop = {}
@ -109,11 +109,7 @@ function update_player()
end end
function update_lever(l) function update_lever(l)
l.angle += 0.001 l.angle -= 0.0005
end
function update_levers()
foreach(levers, update_lever)
end end
function update_drop(d) function update_drop(d)
@ -184,7 +180,7 @@ function draw_lever(l)
dx = l.len * cos(l.angle) dx = l.len * cos(l.angle)
dy = l.len * sin(l.angle) dy = l.len * sin(l.angle)
line(l.x,l.y,l.x+dx,l.y+dy,brown) line(l.x,l.y,l.x+dx,l.y+dy,brown)
rectfill(l.x-1,l.y-1,l.x+1,l.y+1,black) circ(l.x,l.y,1,black)
end end
__gfx__ __gfx__