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

2017/08/24 19:01:03

MixJuice GET URL : kidspod.club/mj/241

キャッチャー・イン・ザ・レーン

画面をタップ(クリック)して、流れてくるアイテムをゲットしよう!
チャンスは10回。取ったアイテムによって点数が変わる。
10回のチャンスで、何点取れるか、チャレンジだ!
IchigoLatteで遊ぶときは、ボタンを押そう。

"The Catcher In The Lane"
Tap (click) the screen and get the item that flows!
Chances are ten times. The score varies depending on the item taken.
It is a challenge how many points you can take with 10 chances!
When playing with IchigoLatte, press the button.

SOURCE CODE

var got;
var score,index;

var handX=15;
var laneY=10;
var remain=10;

function init(){
  cls();
  score=0;
  index=0;
  got=new Array(remain);
}

function result(){
  lc(0,0);log("you caught...");

  var code=got[index];
  lc(13,0);log(index+1);
  lc(index,1);log(chr(code));
  score=score+code%5;

  lc(0,2);log("score:",score);

  index=index+1;

  if(index>=remain){
    lc(0,3);
    if(score<10){
      log("bad...");
    }else{
      log("good!");
    }
    exit();
  }else{
    setTout(result, 1000);
  }
}

function main(){
  if(rnd(10)==0){
    var item=chr(rnd(16)+229);
    lc(0,laneY);log(item);
  }

  if(btn()==1){
    got[index]=scr(handX,laneY);
    lc(handX,laneY);log(" ");
    index=index+1;
  }

  lc(handX,laneY+1);log(" ");
  lc(handX,laneY+2);log("  ");
  scroll(1);
  lc(handX,laneY+1);log(chr(226));
  lc(handX,laneY+2);log(remain-index);

  if(index>=remain){
    index=0;
    result();
    return;
  }

  setTout(main,100);
}

init();
main();

COMMENT