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/10 12:00:34

MixJuice GET URL : kidspod.club/mj/229

メタボライザー・ウサオ

画面をタップ(クリック)して、ウサオを太らせよう!
何秒で100%メタボにできるか、タイムアタックだ。
IchigoLatteで遊ぶときは、ボタンを連打しよう。

※メタボライズ(metabolize)、メタボライザー(metabolizer)に「太る」という意味はありません。

SOURCE CODE

var fat;
var start;

var faceX=15,faceY=5;
var pitch=5;
var hMax=10,wMax=10;

function metabo(x,y){
  lc(x,y);log(chr(143));
}

function init(){
  cls();

  fat=0;
  start=tick();

  lc(faceX,faceY);log(chr(235));
}

function main(){
  var t=(tick()-start)/1000;
  lc(0,0);log("time:");
  lc(5,0);log(t);

  var fatMax=pitch*(hMax+wMax);
  lc(0,1);log((fat*100)/fatMax);
  lc(3,1);log("%");

  var width=0;
  if(fat<=pitch*hMax){
    metabo(faceX,faceY+1+fat/pitch);
  }else{
    if(fat%pitch==0){
      width=(fat-pitch*hMax)/pitch;

      var i=0;
      while(i<=hMax){
        var j=0;
        while(j<width){
          metabo(faceX+j,faceY+1+i);
          metabo(faceX-j,faceY+1+i);
          j=j+1;
        }
        i=i+1;
      }
    }
  }

  if(width>=wMax){
    lc(faceX+1,faceY);log(chr(255));
    lc(faceX+1,faceY-1);log(chr(158));
    lc(0,20);
    exit();
  }

  setTout(main,100);
}

function bf(b){
  if(b==1) fat=fat+1;
}

init();
setBprs(bf);
main();

COMMENT