Adding varying speed

This commit is contained in:
2021-11-11 23:44:28 +01:00
parent 864fd55280
commit b417a01c73

View File

@ -6,16 +6,17 @@ __lua__
function _init()
initpyras()
t=0
end
function _update()
movepyras()
wait()
moveguy()
eatpyras()
end
function _draw()
cls()
cls()
drawbg()
drawguy()
drawpyras()
@ -36,13 +37,13 @@ function moveguy()
end
function drawguy()
pset(guy.x,guy.y,11)
pset(guy.x,guy.y,11)
end
-->8
pyras={}
function initpyras()
for i=1,50 do
for i=1,200 do
pyras[i]={
x=flr(rnd(128)),
y=flr(rnd(128))
@ -81,12 +82,21 @@ function eatpyras()
end
-->8
function drawbg()
offset=1
local offset=1
if(#pyras>9)offset+=1
if(#pyras>99)offset+=1
rectfill(0,0,127,127,1)
print(#pyras,128-4*offset,1,7)
end
function wait()
if t>0.05*#pyras then
movepyras()
t=0
else
t+=1
end
end
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000