_TITLE "Flying - Use Up and Down Arrow Key for speed." DIM x
(800), y
(800), dx
(800), dy
(800), sz
(800), c
(800), shape
(800), xx
(800), ssz
(800)
LINE (0, 360)-(800, 800), _RGB32(67, 200, 150), BF
'Set the default speed, amount of objects, and then make the first objects.
speed = .0005
amount = 100
FOR objects
= 1 TO amount
FOR objects
= 1 TO amount
'Detect the arrow keys to make it go faster or slower.
IF a$
= CHR$(0) + CHR$(72) THEN speed
= speed
+ .0005: warp
= warp
+ 1 IF a$
= CHR$(0) + CHR$(80) THEN speed
= speed
- .0005: warp
= warp
- 1 IF speed
< .0005 THEN speed
= .0005 IF speed
> .02 THEN speed
= .02
'Move the objects.
x(objects) = x(objects) + dx(objects) * speed
y(objects) = y(objects) + dy(objects) * speed
IF x
(objects
) < -800 THEN x
(objects
) = -800 IF x
(objects
) > 800 THEN x
(objects
) = 0
'Get a new object if one goes off the screen.
IF x
(objects
) < -6400 OR x
(objects
) > 6400 OR y
(objects
) < -400 OR y
(objects
) > 400 THEN GOSUB make:
'Draw the objects, c(objects) is the choice of colors
dy(objects) = y(objects) + 10
dx(objects) = x(objects) + xx(objects)
LINE (0, 360)-(800, 800), _RGB32(67, 200, 150), BF
make:
'Get a random X number using 2 decimal points - RND and .5 and times it by the width of the screen.
'Get a random Y number using 2 decimal points - RND and .5 and times it by the height of the screen.
y
(objects
) = INT(RND * 300) + 1
shape
(objects
) = RND * .5
c
(objects
) = INT(RND * 100) + 1
ssz
(objects
) = INT(RND * 8) + 3