home *** CD-ROM | disk | FTP | other *** search
- READY AIM DRAW
-
- by Captain COMAL
-
- Oh no! Not another drawing program.
- Yes, dear readers. We are happy to
- present READY AIM DRAW. While the
- program doesn't come close to the
- commercial drawing programs or our
- own GRAPHICS EDITOR system on TODAY
- DISK #11, it does show you how you
- can combine sprites and drawing on
- the graphics screen. It shows how
- even small programs can do this.
-
- The program starts by setting up
- things (aptly named SETUP). You
- should get used to grouping parts of
- your program into small modules. Give
- each module a name (up to 70
- characters long). From then on,
- whenever you want to execute the
- lines, just call them by name.
- Anyway, our program uses the SETUP
- module to set the screen colors,
- define the sprite, give directions,
- and ask what speed to use. To define
- the sprite shape it calls another
- module, DEFINE'SHAPE (see line 280).
-
- We use the built in DEFINE command to
- define a sprite shape. That shape is
- setup by a 63 character string - plus
- a 64th character that tells whether
- or not it is high resolution. Our
- program uses DATA statements to
- provide the proper string characters.
- But notice, we don't have 63 numbers.
- We only use the numbers needed to set
- up the top corner of the sprite. That
- is all we need. The rest of the
- string is set to CHR$(0) meaning
- blank. To do this we watch for the
- End Of Data (EOD). When EOD becomes
- TRUE, we know we have read the last
- number, and don't read any more (just
- continue using the last number read,
- which is 0).
-
- COMAL understands what TRUE and FALSE
- mean. The program uses them in line
- 310 to set the sprite size to be
- expanded. Also line 80 uses them. The
- program continues to AIM until TRUE
- equals FALSE (which is never). To
- stop the program just hit the STOP
- key or press the Q key (for Quit).
-
- Meanwhile, the AIM module checks the
- keyboard. Press a cursor key and the
- small cross target is moved
- accordingly. Press the letter D to
- draw a line from the last point to
- the point you are currently aiming
- at. Otherwise the routine keeps
- changing the color of the sprite,
- giving a pulsing effect.
-