home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 June / Ahoy_Magazine_86-06_1986_Double_L.d64 / design < prev    next >
Text File  |  2022-10-26  |  1KB  |  60 lines

  1. DESIGNER
  2.  
  3. by Captain COMAL
  4.  
  5. Who me? A designer? Now, an artist
  6. I'm not. But look at what I created
  7. (with a little help from COMAL). And
  8. it only took a few minutes to write
  9. the program that makes the design.
  10. Best of all, you can use the program
  11. as a starting point. The hardest part
  12. of learning to program is starting! I
  13. learned to program on my own years
  14. ago by looking at other peoples
  15. programs and then changing them.
  16.  
  17. Now, how would you draw a box? Draw a
  18. line and turn 90 degrees. Then do
  19. that 3 more times for all four sides:
  20.  
  21. SETGRAPHIC 0
  22. FOR SIDES=1 TO 4
  23.   FORWARD 20
  24.   LEFT 90
  25. ENDFOR
  26.  
  27. That will draw a box on your graphics
  28. screen (the first line puts you in
  29. graphics mode). Try it. Now, the fun
  30. part. Let's give those four lines we
  31. just wrote a name. Let's call them
  32. BOX. Just add a header line above
  33. them, and an ending line after them:
  34.  
  35. PROC BOX
  36.   .....
  37. ENDPROC
  38.  
  39. Now, once your program is run, COMAL
  40. knows what you mean if you give the
  41. command BOX. But always drawing a
  42. size 20 box gets boring. Let's add a
  43. parameter! When we want a box, we
  44. will tell how big at the same time:
  45.  
  46. BOX(30)
  47.  
  48. Change your BOX procedure to look
  49. like it does in the program listing
  50. on the side. Now you can make boxes
  51. any size you want. The procedure
  52. DESIGN draws a series of BOXES at
  53. different angles.
  54.  
  55. Finally, I defined my own function
  56. named DONE. It shows how a function
  57. can include many lines, and even ask
  58. you questions (much different than
  59. the 1 line functions of BASIC).
  60.