~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ Using the "Draw to" Command ~ ~ Jonathan Rutherford ~ ~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ One of the other most important commands that we will be using later on in one of the other Beginners articles, about writing a LOGO programming language in Amos is the "Draw to" command. It will be useful as we can register the last set point using "GR Locate" (explained in the LOGO article) and then draw from that position to a new position using "Draw to". It saves fiddling about with lots of different variables holding information about the co-ordinates and drawing from those different positions, setting it manually. The usage of the command "Draw to" is:- Draw to x,y Where x and y are co-ordinates of the point you want to draw to. It is basically just the Draw command but instead of putting:- Draw x,y to x,y Where you have from co-ordinates followed by to co-ordinates you just put "Draw to" and the line is drawn from the current graphic cursor position to the x and y co-ordinates. eg. Try this: Do Gr Locate 100,100 X=Rnd(320) Y=Rnd(250) Draw to X,Y Loop This might be a bit fast, so we might have to slow it down by adding in the command "Wait 5" just before the "Loop" command. Here's another piece of sourcecode to try. '*** Draw the N Gr Locate 100,100 Draw To 100,50 : Wait 5 Draw to 120,100 : Wait 5 Draw to 120,50 : Wait 5 ' '*** Draw the B Gr Locate 130,50 Draw to 130,100 : Wait 5 Draw to 150,100 : Wait 5 Draw to 140,75 : Wait 5 Draw to 150,50 : Wait 5 Draw to 130,50 : Wait 5 ' '*** Draw the A Gr Locate 160,100 Draw to 170,50 : Wait 5 Draw to 180,100 : Wait 5 Gr Locate 165,75 Draw to 175,75 : Wait 5 ' '*** Draw the M Gr Locate 190,100 Draw to 190,50 : Wait 5 Draw to 200,75 : Wait 5 Draw to 210,50 : Wait 5 Draw to 210,100 : Wait 5 ' '*** Draw the O Gr Locate 220,50 Draw to 240,50 : Wait 5 Draw to 240,100 : Wait 5 Draw to 220,100 : Wait 5 Draw to 220,50 : Wait 5 ' '*** Draw the S Gr Locate 270,50 Draw to 250,50 : Wait 5 Draw to 250,75 : Wait 5 Draw to 270,75 : Wait 5 Draw to 270,100 : Wait 5 Draw to 250,100 Wait 100 End Notice how most of the above program relies on Co-ordinates. Co- ordinates are very important in Amos programming as they are used when positioning Bobs, Sprites, Text etc. and a lot of commands rely on the use of co-ordinates so you need to be fairly competent at using co- ordinates to program well. Catch you next month. Jonathan.