Eightyone emulator not recognizing cursor keys as joystick

Emulator and emulator development specific topics
Exile
Posts: 45
Joined: Tue Jan 03, 2023 9:50 pm

Re: Eightyone emulator not recognizing cursor keys as joystick

Post by Exile »

I've extended the example I gave before to show collision detection.
When you use the cursor keys to move the O to the same position as the X the collision is detected, "BANG" is displayed and the program ends.
The detection of the collision is at line 105, which evaluates to TRUE if a=x AND b=y

Code: Select all

10 LET X=15
20 LET Y=10
25 LET A=7
26 LET B=5
27 PRINT AT B,A;"X"
30 PRINT AT Y,X;"O"
40 LET A$ = INKEY$
50 IF A$="" THEN GOTO 40
60 PRINT AT Y,X;" "
70 IF (A$="5") * (X>0) THEN LET X=X-1
80 IF (A$="6") * (Y<20) THEN LET Y=Y+1
90 IF (A$="7") * (Y>0) THEN LET Y=Y-1
100 IF (A$="8") * (X<30) THEN LET X=X+1
105 IF (A=X) * (B=Y) THEN GOTO 120
110 GOTO 30
120 PRINT AT B,A-1;"BANG"
Post Reply