|
@ -26,7 +26,15 @@ end |
|
|
-->8 |
|
|
-->8 |
|
|
-- game code |
|
|
-- game code |
|
|
|
|
|
|
|
|
bg = 12 |
|
|
|
|
|
|
|
|
bg = blue |
|
|
|
|
|
|
|
|
|
|
|
function _init() |
|
|
|
|
|
-- button-press initial delay |
|
|
|
|
|
poke(0x5f5c, 2) |
|
|
|
|
|
-- button-press repeat |
|
|
|
|
|
poke(0x5f5d, 2) |
|
|
|
|
|
init_world() |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
function init_world() |
|
|
function init_world() |
|
|
player = {} |
|
|
player = {} |
|
@ -38,20 +46,8 @@ function init_world() |
|
|
ramps = {} |
|
|
ramps = {} |
|
|
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(50,60,20,0) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function _init() |
|
|
|
|
|
-- button-press initial delay |
|
|
|
|
|
poke(0x5f5c, 1) |
|
|
|
|
|
-- button-press repeat |
|
|
|
|
|
poke(0x5f5d, 2) |
|
|
|
|
|
init_world() |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function _update() |
|
|
|
|
|
update_player() |
|
|
|
|
|
update_drops() |
|
|
|
|
|
|
|
|
add_ramp(48,60,20,0) |
|
|
|
|
|
add_ramp(45,75,10,30) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function add_ramp(x,y,dx,dy) |
|
|
function add_ramp(x,y,dx,dy) |
|
@ -63,6 +59,11 @@ function add_ramp(x,y,dx,dy) |
|
|
add(ramps, r) |
|
|
add(ramps, r) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function _update() |
|
|
|
|
|
update_player() |
|
|
|
|
|
update_drops() |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
function update_player() |
|
|
function update_player() |
|
|
if btn(0) then |
|
|
if btn(0) then |
|
|
player.x -= 1 |
|
|
player.x -= 1 |
|
@ -89,14 +90,39 @@ function update_player() |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function update_drop(d) |
|
|
|
|
|
if d.y == 127 or pget(d.x,d.y+1) == bg then |
|
|
|
|
|
d.y += 1 |
|
|
|
|
|
return |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
left = pget(d.x-1,d.y) == bg and pget(d.x-1,d.y+1) == bg |
|
|
|
|
|
right = pget(d.x+1,d.y) == bg and pget(d.x+1,d.y+1) == bg |
|
|
|
|
|
|
|
|
|
|
|
if left and right then |
|
|
|
|
|
d.y += 1 |
|
|
|
|
|
if rnd() < 0.5 then |
|
|
|
|
|
d.x -= 1 |
|
|
|
|
|
else |
|
|
|
|
|
d.x += 1 |
|
|
|
|
|
end |
|
|
|
|
|
elseif left then |
|
|
|
|
|
d.y += 1 |
|
|
|
|
|
d.x -= 1 |
|
|
|
|
|
elseif right then |
|
|
|
|
|
d.y += 1 |
|
|
|
|
|
d.x += 1 |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
function update_drops() |
|
|
function update_drops() |
|
|
draw_world() |
|
|
draw_world() |
|
|
new_drops = {} |
|
|
new_drops = {} |
|
|
for i=1,#drops do |
|
|
for i=1,#drops do |
|
|
drop = drops[i] |
|
|
|
|
|
drop.y += 1 |
|
|
|
|
|
if drop.y < 128 then |
|
|
|
|
|
add(new_drops, drop) |
|
|
|
|
|
|
|
|
d = drops[i] |
|
|
|
|
|
update_drop(d) |
|
|
|
|
|
if d.y < 128 then |
|
|
|
|
|
add(new_drops, d) |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
drops = new_drops |
|
|
drops = new_drops |
|
@ -122,7 +148,6 @@ function draw_drop(drop) |
|
|
pset(drop.x, drop.y, white) |
|
|
pset(drop.x, drop.y, white) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__gfx__ |
|
|
__gfx__ |
|
|
000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
|
|
000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
|
|
00000000aaa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
|
|
00000000aaa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
|
|