SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE
`Set the random seed to make sure everything is truly random
RANDOMIZE TIMER()
DIM Clouds(300,3)
`Make 300 randomly sized, randomly positioned spheres
FOR x = 1 TO 300
MAKE OBJECT SPHERE x,RND(100)
POSITION OBJECT x, -400 + RND(800), -400 + RND(800), -400 + RND(800)
GHOST OBJECT ON x
`Here's where we store the cloud's movement angle. Basically the array Clouds() has 3 slots for each cloud,
`these 3 slots are used to store the cloud's xyz angle. This xyz angle is a value inbetween 0 and 360. This
`angle is the angle we'll move the clouds at.
Clouds(x,1) = RND(360)
Clouds(x,2) = RND(360)
Clouds(x,3) = RND(360)
NEXT x
`Main loop
DO
MOVE CAMERA (UPKEY() - DOWNKEY())*0.5
ROTATE CAMERA WRAPVALUE(CAMERA ANGLE X()+(MOUSEMOVEY()*0.1)), WRAPVALUE(CAMERA ANGLE Y()+(MOUSEMOVEX()*0.1)),0
`Use a loop going from 1 to 300, checking each cloud object.
FOR x = 1 TO 300
`Store the clouds starting angle
xA# = OBJECT ANGLE X(x)
yA# = OBJECT ANGLE Y(x)
zA# = OBJECT ANGLE Z(x)
`Rotate the cloud to it's movement angle previously calculated
ROTATE OBJECT x,Clouds(x,1),Clouds(x,2),Clouds(x,3)
`Move the cloud a bit
MOVE OBJECT x,0.5
`Rotate the cloud back to it's original angle
ROTATE OBJECT x,xA#,yA#,zA#
`Repeat
NEXT x
`Display some info text
TEXT 0,0,"FPS: "+STR$(SCREEN FPS())
TEXT 0,15,"Move with the arrow keys."
TEXT 0,30,"Turn with the mouse"
`Refresh the screen
SYNC
`Repeat
LOOP