|
@ -74,7 +74,8 @@ function add_lever(x,y,len) |
|
|
l.x = x |
|
|
l.x = x |
|
|
l.y = y |
|
|
l.y = y |
|
|
l.len = len |
|
|
l.len = len |
|
|
l.angle = 0 |
|
|
|
|
|
|
|
|
l.angle = 0.06 |
|
|
|
|
|
l.weight = 0 |
|
|
add(levers, l) |
|
|
add(levers, l) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
@ -109,7 +110,16 @@ function update_player() |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function update_lever(l) |
|
|
function update_lever(l) |
|
|
l.angle -= 0.0005 |
|
|
|
|
|
|
|
|
weight = 0 |
|
|
|
|
|
for i=0,l.len do |
|
|
|
|
|
x = l.x + i |
|
|
|
|
|
y = l.y + i * sin(l.angle) - 1 |
|
|
|
|
|
while pget(x, y) == white do |
|
|
|
|
|
weight += 1 |
|
|
|
|
|
y -= 1 |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
l.weight = weight |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function update_drop(d) |
|
|
function update_drop(d) |
|
@ -181,6 +191,7 @@ function draw_lever(l) |
|
|
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) |
|
|
circ(l.x,l.y,1,black) |
|
|
circ(l.x,l.y,1,black) |
|
|
|
|
|
print(""..l.weight,1,13,red) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
__gfx__ |
|
|
__gfx__ |
|
|