Adding varying speed
This commit is contained in:
16
pyras.p8
16
pyras.p8
@ -6,10 +6,11 @@ __lua__
|
|||||||
|
|
||||||
function _init()
|
function _init()
|
||||||
initpyras()
|
initpyras()
|
||||||
|
t=0
|
||||||
end
|
end
|
||||||
|
|
||||||
function _update()
|
function _update()
|
||||||
movepyras()
|
wait()
|
||||||
moveguy()
|
moveguy()
|
||||||
eatpyras()
|
eatpyras()
|
||||||
end
|
end
|
||||||
@ -42,7 +43,7 @@ end
|
|||||||
pyras={}
|
pyras={}
|
||||||
|
|
||||||
function initpyras()
|
function initpyras()
|
||||||
for i=1,50 do
|
for i=1,200 do
|
||||||
pyras[i]={
|
pyras[i]={
|
||||||
x=flr(rnd(128)),
|
x=flr(rnd(128)),
|
||||||
y=flr(rnd(128))
|
y=flr(rnd(128))
|
||||||
@ -81,12 +82,21 @@ function eatpyras()
|
|||||||
end
|
end
|
||||||
-->8
|
-->8
|
||||||
function drawbg()
|
function drawbg()
|
||||||
offset=1
|
local offset=1
|
||||||
if(#pyras>9)offset+=1
|
if(#pyras>9)offset+=1
|
||||||
if(#pyras>99)offset+=1
|
if(#pyras>99)offset+=1
|
||||||
rectfill(0,0,127,127,1)
|
rectfill(0,0,127,127,1)
|
||||||
print(#pyras,128-4*offset,1,7)
|
print(#pyras,128-4*offset,1,7)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function wait()
|
||||||
|
if t>0.05*#pyras then
|
||||||
|
movepyras()
|
||||||
|
t=0
|
||||||
|
else
|
||||||
|
t+=1
|
||||||
|
end
|
||||||
|
end
|
||||||
__gfx__
|
__gfx__
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Reference in New Issue
Block a user