Advertisement
masaakiNakamura

Joystic sample for IchigoJam Revised

Apr 2nd, 2016
2,581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' IchigoJam JoyStick Sample Revised
  2. ' Requirment :
  3. ' Connections: IN1 = SW
  4. '              IN2 = VR-X
  5. '              BTN = VR-Y
  6. ' Rev: Line 20 "UART0" has been added.
  7.  
  8. 10 'ジョイスティック サンプル
  9. 20 UART0:CLS
  10. 30 FOR I=0 to 31
  11. 40 LC I,23:?CHR$(145);
  12. 50 NEXT
  13. 70 X=15:Y=21:M=0:D=0:J=0:K=0:P=0
  14. 80 IF D=0 E=RND(31):F=2:D=1
  15. 90 LC 0,0:?"SCORE=";P;
  16. 100 GOSUB 200
  17. 110 GOSUB 300
  18. 120 GOTO 80
  19. 200 IF M=0 AND IN(1)=0 J=X: K=Y-1:M=1:BEEP
  20. 210 A=ANA(0)-512
  21. 220 LCX,Y:?CHR$(32);:X=X-(A<-50)+(A>50)
  22. 224 IF X>31 X=X-1
  23. 225 IF X<0 X=X+1
  24. 226 LCX,Y:?CHR$(240);
  25. 230 IF M=1 LCJ,K:?CHR$(242);
  26. 240 LCE,F:?CHR$(241);
  27. 250 IF M=1 LCJ,K:?CHR$(32);:K=K-1:LCJ,K:?CHR$(242);
  28. 260 'IF D=1 LCE,F:?CHR$(241);
  29. 270 RETURN
  30. 300 IF K=F AND E=J D=0:P=P+10:BEEP:LC E,F:?CHR$(244);:WAIT20:LCE,F:?" ";:M=0
  31. 310 IF M=1 AND K=1 LCJ,K:?CHR$(32);:M=0
  32. 320 RETURN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement