aUCBLogo Demos and Tests / updatetest
to updateTest
setUpdateGraph false
ht cs
n=5
r=Array n
v=Array n
a=(list 0.0 -1.0)
c=Array n
s=Array n
repeat n
[ i=repCount
r.i=(list 600*(rnd-0.5) 200*rnd)
v.i=(list 10*(rnd-0.5) 0.0)
c.i=HSB 360*i/n 1 1
s.i=pick [fbox frbox circ]
]
t=timefine
forever
[ v=v+a
r=r+v
cs
repeat n
[ i=repCount
if (r.i).2 < -200
[ setitem 2 v.i -(v.i).2
setitem 2 r.i (r.i).2+(v.i).2
]
if or ((r.i).1 < -300) ((r.i).1 > 300)
[ setitem 1 v.i -(v.i).1
setitem 1 r.i (r.i).1+(v.i).1
]
pu setpos r.i pd
setpc c.i
setfc c.i
run s.i
]
pu setpos [0 -200] seth 90 setpc 0
label list "fps repcount/(timefine-t)
updateGraph
; updateVars
dispatchMessages
if key? [stop]
]
end
to circ
fillCircle 100
end