Two programs to demonstrate moving an object based on reading the joystick.
Content
Source Code
300 REM Joy Stick Wrap around © Martin DeBoniface 30/09/85
310 LET c=10: LET l=10
320 PRINT AT l,c;"*"
330 LET cc=c: LET ll=l
340 LET s=STICK(1,2)
350 LET b=STICK(2,2)
360 LET c=c+((-31 OR c<31) AND (s=8 OR s=9 OR s=10))-((-31 OR c>0) AND (s=4 OR s=5 OR s=6))
370 LET l=l+((-21 OR l<21) AND (s=2 OR s=6 OR s=10))-((-21 OR l>0) AND (s=1 OR s=5 OR s=9))
380 PRINT AT 9,9;"FIRE" AND b=1
390 PRINT AT ll,cc;" " AND (ll<>l OR cc<>c)
400 GO TO 320
410 SAVE "JoySTICKWrapAr": PRINT #0;AT 0,5;"Rewind ";"Tape to Verify ": VERIFY "JoySTICKWrapAr"
420 STOP
430 REM INDEX Meaningful Variable Names c = column (0-31) l = line (0-21) cc = concurrent c value ll = last l value s = stick value b = button value (FIRE)