モグラたたき(もどき)

 投稿者:しばっち  投稿日:2014年10月19日(日)18時32分21秒
  緑の丸を左クリックする


DIM MX(3),MY(3),NX(3),NY(3)
RANDOMIZE
LET XSIZE=900
LET YSIZE=700
LET SIZE=700
LET TI=1 !'表示時間
CALL GINIT(XSIZE,YSIZE)
SET TEXT HEIGHT 25
SET TEXT JUSTIFY "LEFT" , "TOP"
SET TEXT COLOR 7
LET N=8 !'マスの数 N*N
DIM X(N,N),Y(N,N)
LET RR=SIZE/N/2
LET R=RR/1.5 !'丸の大きさ R=RR~RR/3
FOR I=1 TO N
   FOR J=1 TO N
      LET X(J,I)=RR+(J-1)*SIZE/N
      LET Y(J,I)=RR+(I-1)*SIZE/N
   NEXT J
NEXT I
FOR I=0 TO SIZE STEP SIZE/N
   CALL LINE(I,0,I,SIZE,7)
   CALL LINE(0,I,SIZE,I,7)
NEXT I
LET TY=TIME
PLOT TEXT ,AT 740,300:"残り時間"
DO
   CALL BOXFULL(740,330,XSIZE,360,0)
   SET TEXT COLOR 7
   PLOT TEXT ,AT 740,330:"   "&STR$(INT(120-TIME+TY))
   LET Z=RND
   LET NN=1
   IF Z<.4 THEN LET NN=2
   IF Z<.1 THEN LET NN=3
   FOR K=1 TO NN !'丸の数
      LET S=INT(RND*N)+1
      LET T=INT(RND*N)+1
      LET MX(K)=X(S,T)
      LET MY(K)=Y(S,T)
      CALL CIRCLEFULL(MX(K),MY(K),R,4)
   NEXT K
   MAT NX=MX
   MAT NY=MY
   LET TT=TIME
   LET L=0
   DO
      FOR K=1 TO NN
         MOUSE POLL XX,YY,LEFT,RIGHT
         IF TIME-TT>TI THEN !'時間オーバーならミス
            LET MISS=MISS+NN-L
            CALL BOXFULL(740,150,XSIZE,180,0)
            SET TEXT COLOR 7
            PLOT TEXT ,AT 740,120:" MISS"
            PLOT TEXT ,AT 740,150:"  "&STR$(MISS)
            EXIT DO
         END IF
         IF SQR((MX(K)-XX)^2+(MY(K)-YY)^2)<R AND LEFT=1 THEN !'時間内に丸を左クリック
            CALL CIRCLEFULL(MX(K),MY(K),R,2)
            BEEP
            LET SC=SC+1
            LET L=L+1
            LET MX(K)=0
            LET MY(K)=0
            CALL BOXFULL(740,70,XSIZE,100,0)
            SET TEXT COLOR 7
            PLOT TEXT ,AT 740,40:"SUCCESS"
            PLOT TEXT ,AT 740,70:"  "&STR$(SC)
            WAIT DELAY .1
            IF L=NN THEN EXIT DO
         END IF
      NEXT K
   LOOP
   FOR K=1 TO NN
      CALL CIRCLEFULL(NX(K),NY(K),R,0)
   NEXT K
   LET TT=RND*2+TIME
   DO
   LOOP UNTIL TT-TIME<=0 !'適当な待ち時間
LOOP WHILE TIME-TY<=120 !'プレイ時間 120秒
END

EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,XSIZE-1,YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
CLEAR
END SUB

EXTERNAL SUB CIRCLEFULL(X,Y,RR,C)
SET COLOR C
DRAW DISK WITH SCALE(RR)*SHIFT(X,Y)
END SUB

EXTERNAL SUB BOXFULL(X1,Y1,X2,Y2,C)
SET AREA COLOR C
PLOT AREA:X1,Y1;X2,Y1;X2,Y2;X1,Y2;X1,Y1
END SUB

EXTERNAL SUB LINE(XS,YS,XE,YE,C)
SET COLOR C
PLOT LINES
PLOT LINES:XS,YS;XE,YE
END SUB
 

戻る