EasyManua.ls Logo

AMSTRAD CPC464 - Page 113

AMSTRAD CPC464
249 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
380 DRAW cx%+px%(st,x%),cy%+py%(st,x%),
l+(st MOD 3)
390 DRAW cx%+px%(st,x%+l),cy%+py%(st,
x%+l),l+(st MOD 3)
400 NEXT x%
410 IF st=5 THEN RETURN
420 lc(st)=0
430 cx(st+l)=cx(st)+l.5*r(st)*SIN(sa+lc(st))
440 cy(st+l)=cy(st)+l.5*r(st)*COS(sa+lc(st))
450 st=st+l st=st+l
460 GOSUB 340
470 st=st-1
480 lc(st)=lc(st)+2*sa
490 IF (lc(st) MOD 360)<>0 THEN 430
500 RETURN
510 ik(l)=l+RND*25
520 IF ik(l)=ik(2) OR ik(l>=ik(3) THEN 510
530 INK 1,ik(1)
540 RETURN
550 ik(2)=1+RND*25 ik(2)=1+RND*25
560 IF ik(2)=ik(l) OR ik(2)=ik(3) THEN 550
570 INK 2,ik(2)
580 RETURN
590 ik(3)=1+RND*25 ik(3)=1+RND*25
600 IF ik(3)=ik(l) OR ik(3)=ik(2) THEN 590
610 INK 3,ik(3)
620 RETURN
When you RUN this program, it will ask you a question (line 40) - answer 3 for the speediest
results. The program will then display the message Calculating, and display a dot . every few
seconds (line 245) to indicate that it is still thinking to itself and confirm that the program is still
running.
The subroutines called by lines 300-320 flash the different coloured inks at the rates determined by
the E V E R Y command. If you want to slow down the flashing, E D I T lines 300-320 to read:
300 EVERY 250,l GOSUB 510
310 EVERY 150,2 GOSUB 550
320 EVERY 50,3 GOSUB 590
To see what you have done, look up the E V E R Y command in Chapter 8, its one of the most useful
features in AMSTRAD BASIC. One interesting effect of the E V E R Y command is the way it stacks
up requests to do something if the program is interrupted by pressing the [ESC] key - only ONCE.
Pause the operation of the program for a few seconds by doing this, then restart by pressing any
key. The display will flash frantically as the queued timing instructions rush through to catch up.
Theres only a finite amount of space in the queue, so after a while, the new EVERY command gets
discarded until space is made by allowing those in the queue to work their way through.

Table of Contents

Other manuals for AMSTRAD CPC464

Related product manuals