102 eca00011ff23fe0080333001608 ^7+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+ ^1 A M O S F O R K I D S . ^1 AND THE YOUNG AT HEART! ^7+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+ ^2 We hope that you learnt a bit about programming from the last issue ^2of Totally Amos. ^2 This time we have a little colouring program for you. It isn't very ^2big as there is only one picture to colour in, but maybe you can try ^2to load in your own. ^2 The picture is taken from Paint Me A Story, which was won by Barry ^2and Katy Tilley in the last competition. ^2 You can colour with a plain colour or choose from the pattern chart ^2at the top of the screen. ^7+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+ ^4 The program itself has plenty of Rem notes in the listings to guide ^4you through the program, this article just adds a bit to these notes. ^4 The first line unpacks a packed screen from bank 16 to screen 0. The ^4next two lines call two procedures, one that draws the coloured boxes ^4at the bottom of the screen and one which draws the pattern boxes at ^4the top of the screen. ^5 Now we have to reserve two zones, these are areas that are marked so ^5that Amos can tell when the mouse pointer is on a certain part of the ^5screen. This is done using the Set Zone command with the coordinates ^5of the areas you want as zones. Here we want one at the top for the ^5pattern boxes, and another at the bottom for the colour boxes. Now ^5the program will be able to tell if the player wants to choose a ^5colour or a pattern. ^4 The arrow on the mouse pointer is changed to crosshairs - which look ^4like the sights on a gun, this is easier to use to colour in. ^5 We call the variable that remembers the colour CLR. We set this to ^51. Amos has 34 inbuilt patterns which you can use to fill areas of ^5the screen. Here we are using them to make pretty patterns when we ^5colour something in. First of all we set this to 0, which means that ^5the program will fill an area with a plain colour. If the pattern is ^5set to another number a new pattern will be used. ^2 A `Do' loop is used next, this type of loop carries on working ^2forever, whatever happens! It keeps doing everything that is written ^2between the Do and the Loop. ^1The keyboard is checked to see if any keys have been pressed. If it ^1has, then it is remembered by the variable k$. ^2 The X coordinates and the Y coordinates of the mouse are put into MX ^2and MY. ^1 We have to check now to see if the mouse has moved over a zone, and ^1if the mouse button has been pressed. ^2 The next section is explained in the Rem line below it, basically ^2this section tells the program if the mouse is on the zone which ^2holds the colour palette, then the colour he wants to use is the ^2colour of the pixel he/she clicked on. The variable CLR remembers ^2the colour which will be used when the player wants to paint an area. ^1 The next bit is used if it is found that the user isn't on a zone, ^1which means that he is on the picture ready to paint. Amos makes it ^1easy to paint an area, just use the Paint command with the pixel ^1coordinates of where to paint, in this program, the mouse coordinates ^1MX,MY do this for you. The last bit of thew condition stops the user ^1from painting on a black line so the outline of the picture is kept. ^6 Now we see if the user wants to use a pattern, this is better ^6explained in the Rem lines, we check with the mouse coordinates to ^6see which part of the zone the mouse is over, and the pattern number ^6is worked out from there. ^7 The last part of the loop checks to see if the `c' key has been ^7pressed to clear the screen, if it has, then the screen is unpacked ^7again to give a clean picture to paint. ^6 The procedure MAKEPALETTE is a For Next loop which ranges from 0 to ^631, ie for 32 colours in the palette, which then draws a solid box ^6for each colour in a strip across the bottom of the screen. A black ^6line is drawn along the bottom of the boxes to tidy things up. ^7 The Procedure MAKEPATTERNS starts by clearing an area at the top of ^7the screen to white ready for the patterns. These patterns are ^7displayed by a For Next Loop which fills little squares with each ^7pattern in turn along the top of the screen, then to make the ^7selecter look tidy, we draw a box around each one in black. ^2 That's it! If you add anything to make this program better, such as ^2an undo feature etc, send it to us! ^3 H A V E F U N , S E E Y O U N E X T T I M E ! ^7+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+ \