home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 June / Ahoy_Magazine_86-06_1986_Double_L.d64 / ready aim draw < prev    next >
Encoding:
Text File  |  1986-01-01  |  2.0 KB  |  68 lines

  1. READY AIM DRAW
  2.  
  3. by Captain COMAL
  4.  
  5. Oh no! Not another drawing program.
  6. Yes, dear readers. We are happy to
  7. present READY AIM DRAW. While the
  8. program doesn't come close to the
  9. commercial drawing programs or our
  10. own GRAPHICS EDITOR system on TODAY
  11. DISK #11, it does show you how you
  12. can combine sprites and drawing on
  13. the graphics screen. It shows how
  14. even small programs can do this.
  15.  
  16. The program starts by setting up
  17. things (aptly named SETUP). You
  18. should get used to grouping parts of
  19. your program into small modules. Give
  20. each module a name (up to 70
  21. characters long). From then on,
  22. whenever you want to execute the
  23. lines, just call them by name.
  24. Anyway, our program uses the SETUP
  25. module to set the screen colors,
  26. define the sprite, give directions,
  27. and ask what speed to use. To define
  28. the sprite shape it calls another
  29. module, DEFINE'SHAPE (see line 280).
  30.  
  31. We use the built in DEFINE command to
  32. define a sprite shape. That shape is
  33. setup by a 63 character string - plus
  34. a 64th character that tells whether
  35. or not it is high resolution. Our
  36. program uses DATA statements to
  37. provide the proper string characters.
  38. But notice, we don't have 63 numbers.
  39. We only use the numbers needed to set
  40. up the top corner of the sprite. That
  41. is all we need. The rest of the
  42. string is set to CHR$(0) meaning
  43. blank. To do this we watch for the
  44. End Of Data (EOD). When EOD becomes
  45. TRUE, we know we have read the last
  46. number, and don't read any more (just
  47. continue using the last number read,
  48. which is 0).
  49.  
  50. COMAL understands what TRUE and FALSE
  51. mean. The program uses them in line
  52. 310 to set the sprite size to be
  53. expanded. Also line 80 uses them. The
  54. program continues to AIM until TRUE
  55. equals FALSE (which is never). To
  56. stop the program just hit the STOP
  57. key or press the Q key (for Quit).
  58.  
  59. Meanwhile, the AIM module checks the
  60. keyboard. Press a cursor key and the
  61. small cross target is moved
  62. accordingly. Press the letter D to
  63. draw a line from the last point to
  64. the point you are currently aiming
  65. at. Otherwise the routine keeps
  66. changing the color of the sprite,
  67. giving a pulsing effect.
  68.