aUCBLogo Demos and Tests / scrolltest3
to scrolltest3
norefresh
WindowMode
white=rgb 1 1 1
setsc white
cs ht
setUpdateGraph false
scc=scrollcal [2 0]
stonesinit
courtinit
rim=[400 299]
m=[0 0]
scrolledX=1
forever
[ _setPos [-400 299]
scroll [800 600] scc
m=m+abs scc
if m.1 > stonesize
[ m=mod m stonesize
scrolledX=scrolledX+1
]
drawRim
updateGraph
gc
if key? [stop]
]
end
to stonesinit
cs
stonesize=50
differentStones=8
stone=Array differentStones
repeat differentStones
[ hue=360*repcount/differentStones
setpc hsb hue 1 1
setfc hsb hue 1 1
myfrbox stonesize
stone.repcount=bitCopy stonesize stonesize
]
setpc white
setfc white
myfrbox stonesize
nostone=bitCopy stonesize stonesize
end
to myfrbox size
pu rt 45 fd size/(sqrt 2) lt 45 pd
(frBox size)
pu lt 135 fd size/(sqrt 2) rt 135 pd
end
to courtinit
cs
pu
_setpos [-400 299]
setheading 90
sx=int 800/stonesize
sy=int 400/stonesize
stones=0
repeat sy
[ repeat sx
[ bitPaste stone.(1+mod repcount differentStones)
stones=stones+1
fd stonesize
]
bk sx*stonesize
rt 90 fd stonesize lt 90
]
end
to drawRim
_setPos rim-m
setHeading 180
repeat sy
[ bitPaste stone.(1+mod (sx+scrolledX) differentStones)
fd stonesize
]
end