home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / totallyamos / issue2 / programming / kids.seq < prev    next >
Text File  |  1991-09-02  |  5KB  |  105 lines

  1.  102
  2. eca00011ff23fe0080333001608
  3. ^7+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+
  4.  
  5. ^1                      A M O S  F O R  K I D S .
  6.  
  7. ^1                       AND THE YOUNG AT HEART!
  8.  
  9. ^7+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+
  10.  
  11. ^2 We  hope that you learnt a bit about programming from the last issue
  12. ^2of Totally Amos.
  13.  
  14. ^2 This time we have a little colouring program for you.  It isn't very
  15. ^2big  as there is only one picture to colour in, but maybe you can try
  16. ^2to load in your own.
  17.  
  18. ^2 The  picture  is taken from Paint Me A Story, which was won by Barry
  19. ^2and Katy Tilley in the last competition.
  20.  
  21. ^2 You  can colour with a plain colour or choose from the pattern chart
  22. ^2at the top of the screen.
  23.  
  24. ^7+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+
  25.  
  26. ^4 The program itself has plenty of Rem notes in the listings to guide
  27. ^4you through the program, this article just adds a bit to these notes.
  28.  
  29. ^4 The first line unpacks a packed screen from bank 16 to screen 0. The
  30. ^4next two lines call two procedures, one that draws the coloured boxes
  31. ^4at the bottom of the screen and one which draws the pattern boxes at
  32. ^4the top of the screen. 
  33.  
  34. ^5 Now we have to reserve two zones, these are areas that are marked so
  35. ^5that Amos can tell when the mouse pointer is on a certain part of the
  36. ^5screen.  This is done using the Set Zone command with the coordinates
  37. ^5of  the areas you want as zones.  Here we want one at the top for the
  38. ^5pattern  boxes,  and another at the bottom for the colour boxes.  Now
  39. ^5the  program  will  be  able  to tell if the player wants to choose a
  40. ^5colour or a pattern.
  41.  
  42. ^4 The arrow on the mouse pointer is changed to crosshairs - which look
  43. ^4like the sights on a gun, this is easier to use to colour in.
  44.  
  45. ^5 We  call the variable that remembers the colour CLR.  We set this to
  46. ^51.   Amos  has 34 inbuilt patterns which you can use to fill areas of
  47. ^5the  screen.   Here we are using them to make pretty patterns when we
  48. ^5colour something in.  First of all we set this to 0, which means that
  49. ^5the program will fill an area with a plain colour.  If the pattern is
  50. ^5set to another number a new pattern will be used.
  51.  
  52. ^2 A  `Do'  loop  is  used  next,  this type of loop carries on working
  53. ^2forever, whatever happens!  It keeps doing everything that is written
  54. ^2between the Do and the Loop.
  55.  
  56. ^1The  keyboard is checked to see if any keys have been pressed.  If it
  57. ^1has, then it is remembered by the variable k$.
  58.  
  59. ^2 The X coordinates and the Y coordinates of the mouse are put into MX
  60. ^2and MY.
  61.  
  62. ^1 We  have to check now to see if the mouse has moved over a zone, and
  63. ^1if the mouse button has been pressed.
  64.  
  65. ^2 The  next  section  is explained in the Rem line below it, basically
  66. ^2this  section  tells   the  program if the mouse is on the zone which
  67. ^2holds  the  colour  palette,  then  the colour he wants to use is the
  68. ^2colour  of  the  pixel he/she clicked on.  The variable CLR remembers
  69. ^2the colour which will be used when the player wants to paint an area.
  70.  
  71. ^1 The  next  bit is used if it is found that the user isn't on a zone,
  72. ^1which  means that he is on the picture ready to paint.  Amos makes it
  73. ^1easy  to  paint  an  area,  just use the Paint command with the pixel
  74. ^1coordinates of where to paint, in this program, the mouse coordinates
  75. ^1MX,MY do this for you.  The last bit of thew condition stops the user
  76. ^1from painting on a black line so the outline of the picture is kept.
  77.  
  78. ^6 Now  we  see  if  the  user  wants  to use a pattern, this is better
  79. ^6explained  in  the  Rem lines, we check with the mouse coordinates to
  80. ^6see  which part of the zone the mouse is over, and the pattern number
  81. ^6is worked out from there.
  82.  
  83. ^7 The  last  part  of  the  loop checks to see if the `c' key has been
  84. ^7pressed  to  clear the screen, if it has, then the screen is unpacked
  85. ^7again to give a clean picture to paint.
  86.  
  87. ^6 The  procedure MAKEPALETTE is a For Next loop which ranges from 0 to
  88. ^631,  ie  for  32 colours in the palette, which then draws a solid box
  89. ^6for  each colour in a strip across the bottom of the screen.  A black
  90. ^6line is drawn along the bottom of the boxes to tidy things up.
  91.  
  92. ^7 The  Procedure MAKEPATTERNS starts by clearing an area at the top of
  93. ^7the  screen  to  white  ready  for  the patterns.  These patterns are
  94. ^7displayed  by  a  For  Next Loop which fills little squares with each
  95. ^7pattern  in  turn  along  the  top  of  the  screen, then to make the
  96. ^7selecter look tidy, we draw a box around each one in black.
  97.  
  98. ^2 That's it!  If you add anything to make this program better, such as
  99. ^2an undo feature etc, send it to us!
  100.  
  101. ^3       H A V E   F U N ,   S E E   Y O U   N E X T   T I M E !
  102.  
  103. ^7+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+
  104. \
  105.