|
|
@ -5,6 +5,7 @@ __lua__ |
|
|
|
|
|
|
|
function init_world() |
|
|
|
drops = {} |
|
|
|
frozen_drops = {} |
|
|
|
player = {} |
|
|
|
player.x = 64 |
|
|
|
player.y = 16 |
|
|
@ -90,14 +91,14 @@ function update_drops() |
|
|
|
drop.fall_time = 0 |
|
|
|
elseif drop.momentum == -1 then |
|
|
|
drop.fall_time += 1 |
|
|
|
if drop.x > 0 and pget(drop.x-1, drop.y) == black and drop.fall_time < 10 then |
|
|
|
if drop.x > 0 and pget(drop.x-1, drop.y) == black then |
|
|
|
drop.x -= 1 |
|
|
|
else |
|
|
|
drop.momentum = 0 |
|
|
|
end |
|
|
|
elseif drop.momentum == 1 then |
|
|
|
drop.fall_time += 1 |
|
|
|
if drop.x < 127 and pget(drop.x+1, drop.y) == black and drop.fall_time < 10 then |
|
|
|
if drop.x < 127 and pget(drop.x+1, drop.y) == black then |
|
|
|
drop.x += 1 |
|
|
|
else |
|
|
|
drop.momentum = 0 |
|
|
@ -105,6 +106,17 @@ function update_drops() |
|
|
|
end |
|
|
|
if drop.y > 127 then drop.y = 127 end |
|
|
|
end |
|
|
|
|
|
|
|
new_drops = {} |
|
|
|
for i=1,#drops do |
|
|
|
drop = drops[i] |
|
|
|
if drop.fall_time > 64 then |
|
|
|
add(frozen_drops, drop) |
|
|
|
else |
|
|
|
add(new_drops, drop) |
|
|
|
end |
|
|
|
end |
|
|
|
drops = new_drops |
|
|
|
end |
|
|
|
|
|
|
|
function _draw() |
|
|
@ -113,6 +125,7 @@ function _draw() |
|
|
|
draw_player() |
|
|
|
--print("cpu: "..stat(1), 0, 0, light_gray) |
|
|
|
--print("drops: "..#drops, 0, 6, light_gray) |
|
|
|
--print("frozen: "..#frozen_drops, 0, 12, light_gray) |
|
|
|
end |
|
|
|
|
|
|
|
function draw_player() |
|
|
@ -120,13 +133,32 @@ function draw_player() |
|
|
|
end |
|
|
|
|
|
|
|
function draw_drops() |
|
|
|
foreach(frozen_drops,draw_drop) |
|
|
|
foreach(drops,draw_drop) |
|
|
|
circfill(93, 94, 3, green) |
|
|
|
circfill(97, 105, 2, orange) |
|
|
|
line(20, 20, 90, 60, peach) |
|
|
|
line(20, 21, 90, 61, peach) |
|
|
|
circfill(94, 94, 3, green) |
|
|
|
circfill(98, 105, 2, orange) |
|
|
|
line(98, 115, 98, 122, pink) |
|
|
|
line(105, 122) |
|
|
|
line(105, 115) |
|
|
|
|
|
|
|
line(70, 64, 90, 60, dark_purple) |
|
|
|
line(70, 65, 90, 61, dark_purple) |
|
|
|
|
|
|
|
line(60, 30, 80, 50, indigo) |
|
|
|
line(60, 31, 80, 51, indigo) |
|
|
|
|
|
|
|
line(64, 90, 74, 90) |
|
|
|
line(70, 86) |
|
|
|
line(68, 86, 64, 90) |
|
|
|
|
|
|
|
ovalfill(54, 95, 74, 100, pink) |
|
|
|
|
|
|
|
line(70, 116, 93, 112, green) |
|
|
|
line(70, 115, 93, 111, green) |
|
|
|
line(70, 116, 60, 112, green) |
|
|
|
line(70, 115, 60, 111, green) |
|
|
|
|
|
|
|
print("hello everybody", 63, 63, yellow) |
|
|
|
print("hello everybody", 63, 58, yellow) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|