EasyManua.ls Logo

Commodore Plus 4 - SECTION 13 Introduction (RS-232)

Commodore Plus 4
464 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Graphics
Programming
in
BASIC
197
Multicolor
Example
Program
This
program
draws
three
sets
of
circles,
one
in
each
of
the
three
nonbackground
colors.
The
program
demonstrates
that
these three
colors
are
independent,
but
drawing
over
a
color
replaces
it.
At
the
end,
the
foreground
color
is
changed
to
black
to plot
the
characters
in
"HIT
KEY".
After
the
user
hits
a
key,
a
line
is
drawn
in
background
color
through
the
circles.
Even
though
the
line
is
drawn
in
background
color,
the
foreground
color
of
the
character
cells
through
which
it
passes
is
changed
to
black,
spoiling
the
circles
drawn
in
foreground
colors.
10
GRAPHIC3,1
SO
C0L0Rl,2,6:C0L0R2,5,5,:C0L0R3,13,4
30
F0RO3T01STEP-1
40
F0RA=0T0180STEP10
50
CIRCLEC,40+C*20,100a0,50,,,A,20
60
NEXTA,C
70
COLOR1AA-CHAR1,5,2O/'HITKEY''
80
GETKEYK$:DRAWO,0,100T0159,100
90
GETKEYK$:GRAPHIC0
Line-by-Line
Explanation
10
Get
into
multicolor
graphic
mode.
20
Set
up
the
foreground
color,
multicolor
1,
and
multicolor
2.
30
Draw
in
each
of
the
three
nonbackground
colors.
40
Draw
ovals
at
a
series
of
angles.
50
Draw
an
oval.
60
Do
the
next
angle
and
the
next
color.
70
Change
the
foreground
color
to
black.
80
Wait
for
a
key
press.
Then,
draw
a
line
in
background
color
through
the
ovals.
90
Wait
for
a
key
press.
Then,
return
to
text
mode.
The
Pixel
Cursor
and
Relative
Coordinates
Each
of
the
BASIC
drawing
statements
needs
at
least
one
set
of
coordinates.
If
you
review
those
statements
(BOX,
CIRCLE,
DRAW,
PAINT,
SSHAPE,
and
GSHAPE)
in
the
BASIC
language
section,
you
will
notice
that
in
many
cases
the
coordinates
have
a
default
value
of
the
location
of
the
pixel
cursor.
The
pixel
cursor
is
an
invisible
set
of
coordinates
that
BASIC
keeps
track
of
at
all
times.

Other manuals for Commodore Plus 4

Related product manuals