1
0
mirror of https://github.com/mbirth/gwbasic.git synced 2024-11-09 23:06:45 +00:00
gwbasic/JOYSTICK/JOYSTICK.BAS

34 lines
1.1 KiB
QBasic
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

10 CLS
20 REM Bildaufbau
30 COLOR 12
40 LOCATE 1,33:PRINT"JOYSTICK-DATEN"
50 COLOR 14
60 LOCATE 3,1:PRINT"Joystick A:"
70 COLOR 15
80 PRINT"X-Axis"
90 PRINT"Y-Axis"
100 PRINT"Button A"
110 PRINT"Button B"
120 C=15
130 D=15
140 E=15
150 F=15
160 A=STICK(0):B=STICK(1)
170 REM Hauptteil
180 A(1)=STICK(0):A(2)=STICK(1):A(3)=STRIG(0):A(4)=STRIG(4)
190 B(1)=STICK(2):B(2)=STICK(3):B(3)=STRIG(2):B(4)=STRIG(6)
200 IF INKEY$=CHR$(27) THEN END
210 IF A(1)<A-10 THEN A$(1)="LEFT ":C=10:GOTO 240
220 IF A(1)>A+10 THEN A$(1)="RIGHT":C=10:GOTO 240
230 A$(1)=" ":C=15
240 IF A(2)<B-10 THEN A$(2)="UP ":D=10:GOTO 270
250 IF A(2)>B+10 THEN A$(2)="DOWN":D=10:GOTO 270
260 A$(2)=" ":D=15
270 REM Anzeigen
280 LOCATE 4,11:PRINT USING"###";A(1);:COLOR C:PRINT " ";A$(1):COLOR 15
290 LOCATE 5,11:PRINT USING"###";A(2);:COLOR D:PRINT " ";A$(2)
300 C=15:D=15
310 IF A(3)=-1 THEN COLOR 10:LOCATE 6,11:PRINT" ON" ELSE COLOR 12:LOCATE 6,11:PRINT"OFF"
320 IF A(4)=-1 THEN COLOR 10:LOCATE 7,11:PRINT" ON" ELSE COLOR 12:LOCATE 7,11:PRINT"OFF"
330 COLOR 15:GOTO 170