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

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

COMMENT