Enjoy programming more!
Kidspod is a post site which supports young programmers.
First step to join us.
Register as a member
For members

2019/03/07 17:07:15

MixJuice GET URL : kidspod.club/mj/766

SNAKE ミニゲーム

IchigoJamSWITCH用 ミニゲーム

ヘビを餌に導こう
ボタンでスタート
上下左右で方向を決める

SOURCE CODE

  1. 10'SNAKE
  2. 20SWITCH1:FORI=1TO4:OUTI,-1:NEXT
  3. 30LC0,0,1:?"SNAKE";:GSB@W:CLS
  4. 40X=2+RND(12):Y=2+RND(4):R=RND(4):LCX,Y:?"@";
  5. 50LCRND(16),RND(8):?"~F5";:GSB@W
  6. 60@LP
  7. 70IF!IN(5)R=1
  8. 80IF!IN(6)R=2
  9. 90IF!IN(7)R=0
  10. 100IF!IN(8)R=3
  11. 110LCX,Y:?"O";
  12. 120IFR=0Y=Y-1
  13. 130IFR=2Y=Y+1
  14. 140IFR=1X=X-1
  15. 150IFR=3X=X+1
  16. 160IFSCR(X,Y)=245GOTO@GET
  17. 170IF(X<0)OR(X>15)OR(Y<0)OR(Y>7)OR(SCR(X,Y)<>0)GOTO@ED
  18. 180LCX,Y:?"@";:BEEP250,3:WAIT10:GOTO@LP
  19. 190@ED:LCX,Y:?"X";:BEEP100:WAIT10:BEEP80:WAIT30:GSB@W:F=FILE():LRUN0
  20. 200@GET:FORI=2TO8:BEEP20-I,2:WAIT3:NEXT:RUN
  21. 210@W:IF!BTN()CONT:ELSEBEEP2
  22. 220IFBTN()CONT:ELSEBEEP5:RTN

COMMENT

S