home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1986 June
/
Ahoy_Magazine_86-06_1986_Double_L.d64
/
design
< prev
next >
Wrap
Text File
|
2022-10-26
|
1KB
|
60 lines
DESIGNER
by Captain COMAL
Who me? A designer? Now, an artist
I'm not. But look at what I created
(with a little help from COMAL). And
it only took a few minutes to write
the program that makes the design.
Best of all, you can use the program
as a starting point. The hardest part
of learning to program is starting! I
learned to program on my own years
ago by looking at other peoples
programs and then changing them.
Now, how would you draw a box? Draw a
line and turn 90 degrees. Then do
that 3 more times for all four sides:
SETGRAPHIC 0
FOR SIDES=1 TO 4
FORWARD 20
LEFT 90
ENDFOR
That will draw a box on your graphics
screen (the first line puts you in
graphics mode). Try it. Now, the fun
part. Let's give those four lines we
just wrote a name. Let's call them
BOX. Just add a header line above
them, and an ending line after them:
PROC BOX
.....
ENDPROC
Now, once your program is run, COMAL
knows what you mean if you give the
command BOX. But always drawing a
size 20 box gets boring. Let's add a
parameter! When we want a box, we
will tell how big at the same time:
BOX(30)
Change your BOX procedure to look
like it does in the program listing
on the side. Now you can make boxes
any size you want. The procedure
DESIGN draws a series of BOXES at
different angles.
Finally, I defined my own function
named DONE. It shows how a function
can include many lines, and even ask
you questions (much different than
the 1 line functions of BASIC).