aUCBLogo Demos and Tests / flappingflag
to flappingflag
setUpdateGraph false
perspective cs ht setPenSize [0 0]
setEye {0 0 500}{0 0 0}{0 1 0}
flagimage=loadImage "usaflag.png
flagtex=Texture flagimage
setPenColor "white
Nx=32
Ny=20
f=25
p=(mdarray list Nx+1 Ny+1 0)
u=(mdarray list Nx+1 Ny+1 0)
r=(mdarray list Nx+1 Ny+1 0)
setXYZ -400 -300 0 right 90
o0=Orientation
for [y 0 Ny]
[ setY y*f-250
p.(0).y=PosXYZ
]
for [x 0 Nx]
[ for [y 0 Ny]
[ r.x.y=0
u.x.y=0
]
]
running=true
while [running]
[ home
for [x 1 Nx]
[ for [y 0 Ny]
[ setPosXYZ p.(x-1).y
setOrientation o0
r.x.y=r.x.y*0.9+(rnd-0.5)*4
u.x.y=u.x.y*0.9+(rnd-0.5)*8
right r.x.y
up u.x.y
fd f
p.x.y=PosXYZ
]
]
cs
PenDown
SurfaceStart
for [x 0 Nx]
[ for [y 0 Ny]
[ setTexXY x/Nx y/Ny
;setpc HSB 20*x*y 1 1
setPosXYZ p.x.y
]
SurfaceColumn
]
SurfaceEnd
updateGraph
if key? [running=false]
]
end