Chapter
10
I
BASIC
Keywords
STICK
Function
STICK (action)
Returns the coordinates of the joysticks.
Action may be one of the following:
0
1
2
3
reads all
4
coordinates, and returns the horizontal (x)
coordinate for Joystick A.
returns the vertical (y) coordinate for Joystick
A.
returns the horizontal
(x)
coordinate for Joystick
B.
returns the vertical (y) coordinate for Joystick
B.
The coordinates returned by STICK(l), STICK(2), and STICK(3)
are those previously read by STICK(0).
Joystick A is the left joystick and Joystick B
is the
right joystick.
Sample Program
The following program continually displays the coordinates of
joystick
B.
1 0 CLS
2 0 LOCATE 1 ,I
2 5 T = S T I C K < 0 )
3 0 P R
I
N T " B :
" ; S T I C K ( 2 )
4
0
P R
I
N T " B :
"
;
ST
I
C
K
(
3 1
5 0 GOT0 2 0
315