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

2017/11/01 19:48:59

MixJuice GET URL : kidspod.club/mj/392

バベルの塔

タップ(クリック)で、空中を動いている基地から塔の材料を発射しよう。
塔を基地の高さまで積み上げたらゲームクリア!
タイムアタックだ!
IchigoLatteで遊ぶときは、ボタンを押そう。

IchigoLatteについてはこちら。
http://ichigolatte.shizentai.jp


"The Tower of Babel"
Let's fire the tower material from the moving base in the air with a tap (click).
Pile up the tower to the height of the base and clear the game!
It's time attack!
When playing with IchigoLatte, press the button.

IchigoLatte details here.
http://ichigolatte.shizentai.jp

SOURCE CODE

var time=0;
var ctr=15, gnd=20;

var x=15,y=2,v=1;
var b_x=0,b_y=0,b_b=0;
var clr=0;

function isEmp(x,y){
  var c=scr(x,y);
  if((c==0)+(c==32)) return 1;
  return 0;
}

function main(){
  lc(0,0);log("time:",time);

  lc(x,y);log(" ");
  if(x<=5) v=1;
  if(x>=25) v=-1;
  x=x+v;
  lc(x,y);log(chr(237));

  if(btn()*(b_b==0)){
    b_b=1;
    b_x=x;
    b_y=y;
  }

  if(b_b==1){
    lc(b_x,b_y);log(" ");
    b_y=b_y+1;

    var code=247;
    if(!isEmp(b_x,b_y+1)+((b_y+1)>=gnd)){
      b_b=0;
      code=143;
      if(b_y<=y+1)clr=1;
    }

    lc(b_x,b_y);log(chr(code));
  }

  if(clr==1){
    lc(3,15);log("Your Tower is The Babel!!\n");
    exit();
  }

  time=time+1;
  setTout(main,100);
}

cls();
var i=0;
while(i<32){
  lc(i,gnd);log(chr(143));
  i=i+1;
}
main();

COMMENT