EasyManua.ls Logo

Texas Instruments TI-99/4A - Page 176

Texas Instruments TI-99/4A
204 pages
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...
Bouncing
Ball
This
program
moves a ball
and
bounces it off
the
edges of the
screen.
Each
time
the
ball
hits
any
side,
a
tone
sounds.
and
the
ball
is
d~flected.
The
following special
character
is
used to define the
ball.
Block
Codes
Examples:
x
X
X
X
X
X
X
X X
X
X X
X
X
X X X
X
X X
X
X
X
X X
X
X X
X X X X X
X
X
X
X
X
X X X
X
X
X
X
X X X
X
X
X X
3C
7E
FF
FF
FF
FF
7E
3C
:>NEW
These
statements
clear
the SCreen
and
define
character
96
as
the
ball.
These
statements
allow you to input
the
color
of
the
ball
and
the
screen
background
color. N
ate
that
defining
the
screen
color by
using
character
set
1.
which
includes
character
32
(the
blank
space), gives definite limits for
the
screen
edge.
The
screen
is
cleared
when
the colors
have
been
entered.
These
statements
give
the
starting
position for the ball
and
set
the
parameters
which will control the X
and
Y direction.
These
statements
compute
the
next ball position.
The
direction the
ball moves
depends
on
the
current
values
01
XDIR
(+
1 indicates
right,
-1
indicates left)
and
YOIR
(+ 1 indicates up.
-1
indicates
down).
These
statements
test
to
see
if the
new
ball position is still on the
screen.
If
either
the
row
(Y)
or column (X) value is
out
of
range,
then
the
program
transfers
to
line
310
(eolumn
out
of
range)
or
line
360
(row out
of
range}
to
change
the ball direction.
111-20
>100
REM
BOUNCING
BALL
>110 O.LL
CLEAR
>120
CALL
CHAR(96,"3C7EFFFFFF
FF7E3C"}
>130
INPUT
"BALL
COLOR?
":C
>140
INPUT
"SCREEN
COLOR?
":S
>150
CALL
CLEAR
>160
CALL
COLOR(9,c,S)
>170
CALL
COLOR(1,S,S)
>180
X"'16
>190
Y"'12
>200
XDIR"'1
>210
VOIR=1
>220 X=X+XDIR
>230
V~V+VDIR
>240 IF
X<1
THEN
310
>250
IF X>32
THEN
310
>260
IF
Y<1
THEN
360
>270
IF
Y>24
THEN
360
User's
Reference Guide

Other manuals for Texas Instruments TI-99/4A

Related product manuals