海で泳ぐ魚 (スタンプ版)

説明

8個の魚が泳ぐだけのデモです。これはIchigoCakeのスタンプ機能の反転テストのためのコードです。

[サンプルプログラムをダウンロード]

// Fish demo (Stamp version)
var pc=new PanCake();
var fish=new Array(8);
pc.reset();
pc.wbuf(1);
function Fish(){
 this.x=rnd(70);
 this.y=rnd(32);
 this.dx=1;
}
var i=0;
while(i<fish.length){
 fish[i]=new Fish();
 i=i+1;
}
while(1){
 pc.image(4);
 var i=0;
 while(i<fish.length){
  fish[i].x=fish[i].x+fish[i].dx;
  if((fish[i].x<0)+(fish[i].x>72)){fish[i].dx=-fish[i].dx;}
  if(fish[i].dx>0){
   pc.stamps(fish[i].x,fish[i].y,0x2f);
  }else{
   pc.stamps(fish[i].x,fish[i].y,0x2f,1);
  }
  i=i+1;
 }
 pc.wbuf(1);
}

目次に戻る