Compare commits
No commits in common. "0d902cb2bdffdf5245e89c9b321ad437bf280e98" and "a0c8c7db53debcaacbc0aad6aeffa3d615a61d6c" have entirely different histories.
0d902cb2bd
...
a0c8c7db53
61
drip.p8
61
drip.p8
@ -13,7 +13,7 @@ end
|
||||
|
||||
function _init()
|
||||
-- button-press initial delay
|
||||
poke(0x5f5c, 1)
|
||||
poke(0x5f5c, 2)
|
||||
-- button-press repeat
|
||||
poke(0x5f5d, 2)
|
||||
init_world()
|
||||
@ -25,16 +25,16 @@ function _update()
|
||||
end
|
||||
|
||||
function update_player()
|
||||
if btn(0) then
|
||||
if (btn(0)) then
|
||||
player.x -= 1
|
||||
end
|
||||
if btn(1) then
|
||||
if (btn(1)) then
|
||||
player.x += 1
|
||||
end
|
||||
if btn(2) then
|
||||
if (btn(2)) then
|
||||
player.y -= 1
|
||||
end
|
||||
if btn(3) then
|
||||
if (btn(3)) then
|
||||
player.y += 1
|
||||
end
|
||||
if (player.y < 0) player.y = 0
|
||||
@ -46,7 +46,6 @@ function update_player()
|
||||
drop = {}
|
||||
drop.x = player.x
|
||||
drop.y = player.y
|
||||
drop.momentum = 0
|
||||
found_drop = false
|
||||
for i=1,#drops do
|
||||
if (drops[i].x == player.x and drops[i].y == player.y) then
|
||||
@ -60,44 +59,20 @@ function update_player()
|
||||
end
|
||||
end
|
||||
|
||||
function update_drop(drop)
|
||||
drop.y += 1
|
||||
return drop.y < 128
|
||||
end
|
||||
|
||||
function update_drops()
|
||||
cls()
|
||||
draw_drops()
|
||||
new_drops = {}
|
||||
for i=1,#drops do
|
||||
drop = drops[i]
|
||||
try_left = rnd() < 0.5
|
||||
if drop.momentum == 0 then
|
||||
if try_left then
|
||||
drop.momentum = -1
|
||||
else
|
||||
drop.momentum = 1
|
||||
end
|
||||
result = update_drop(drops[i])
|
||||
if result then
|
||||
add(new_drops, drops[i])
|
||||
end
|
||||
if pget(drop.x, drop.y+1) == black then
|
||||
drop.y += 1
|
||||
elseif try_left and drop.x > 0 and
|
||||
pget(drop.x-1, drop.y+1) == black then
|
||||
drop.x -= 1
|
||||
drop.y += 1
|
||||
elseif drop.x < 127 and
|
||||
pget(drop.x+1, drop.y+1) == black then
|
||||
drop.x += 1
|
||||
drop.y += 1
|
||||
elseif drop.momentum == -1 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
|
||||
if drop.x < 127 and pget(drop.x+1, drop.y) == black then
|
||||
drop.x += 1
|
||||
else
|
||||
drop.momentum = 0
|
||||
end
|
||||
end
|
||||
if drop.y > 127 then drop.y = 127 end
|
||||
end
|
||||
drops = new_drops
|
||||
end
|
||||
|
||||
function _draw()
|
||||
@ -114,12 +89,6 @@ end
|
||||
|
||||
function draw_drops()
|
||||
foreach(drops,draw_drop)
|
||||
circfill(94, 94, 3, green)
|
||||
line(20, 20, 90, 60)
|
||||
line(20, 21, 90, 61)
|
||||
|
||||
print("hello there", 63, 63, yellow)
|
||||
|
||||
end
|
||||
|
||||
function draw_drop(drop)
|
||||
|
Loading…
Reference in New Issue
Block a user