Compare commits

..

2 Commits

View File

@ -38,7 +38,7 @@ end
function init_world()
player = {}
player.x = 64
player.x = 36
player.y = 16
player.spr = 1
@ -46,6 +46,8 @@ function init_world()
ramps = {}
levers = {}
add_ramp(70,25,40,-5)
add_ramp(50,20,15,10)
add_ramp(60,50,15,-15)
add_ramp(52,60,14,0)
@ -79,7 +81,7 @@ end
function _update()
update_player()
update_drops()
update_levers()
foreach(levers, update_lever)
end
function update_player()
@ -95,10 +97,8 @@ function update_player()
if btn(3) then
player.y += 1
end
if (player.y < 0) player.y = 0
if (player.y > 127) player.y = 127
if (player.x < 0) player.x = 0
if (player.x > 127) player.x = 127
player.x = mid(0, player.x, 127)
player.y = mid(0, player.y, 127)
if btnp(🅾️) then
drop = {}
@ -109,11 +109,7 @@ function update_player()
end
function update_lever(l)
l.angle += 0.001
end
function update_levers()
foreach(levers, update_lever)
l.angle -= 0.0005
end
function update_drop(d)
@ -146,10 +142,14 @@ function update_drops()
new_drops = {}
for i=1,#drops do
d = drops[i]
oldx = d.x
oldy = d.y
update_drop(d)
if d.y < 128 then
add(new_drops, d)
end
pset(oldx, oldy, bg)
pset(d.x, d.y, white)
end
drops = new_drops
end
@ -180,7 +180,7 @@ function draw_lever(l)
dx = l.len * cos(l.angle)
dy = l.len * sin(l.angle)
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
__gfx__