前  トップ

チュートリアル(エクステンデット)

全ソースコード

Enemy.tonyu
extends SpriteChar;
function onDie() {
  appear(new Bomb(x , y ,$pat_Sample+4));
}
function atariHantei() {
  for (t in $chars) {
   if ( t is Tama && crashTo(t) )  {
     die();
     $score=$score+10;
   } 
  }
  if (crashTo($myChar)) $myChar.die();
}
nexty=rnd(50)+100;while (y<nexty) {
  y=y+2;
  atariHantei();
  update();
}
if (x>$myChar.x) vx=2; else vx=-2;
while (y<$screenHeight) {
  y=y+3;
  x=x+vx;
  atariHantei();
  update();
}

myChar.tonyu
extends SpriteChar;
 
function onDie() {
  appear(new Bomb($myChar.x , $myChar.y ,$pat_Sample+4));
}

while(1) {
 if (getkey(39)>0 && x<$screenWidth ) x=x+3;
 if (getkey(37)>0 && x>0) x=x-3;
 if (getkey(32)==1) appear(new Tama(x,y,$pat_Sample+1));
 update();
}

UFO.tonyu
extends SpriteChar;
function appearEnemy() {
   if (rnd( 50 )==0) appear(new Enemy(x,y,$pat_Sample+2));
}
while(1) {
 while(x<$screenWidth) {
   x=x+2;
   appearEnemy();
   update();
 }
 while(x>0) {
   x=x-2;
   appearEnemy();
   update();
 }
}

Tama.tonyu
extends SpriteChar;
while(y>0) {
 y=y-8;
 update();
}

Bomb.tonyu
extends SpriteChar;
wait(5);
p=p+1;
wait(5);
p=p+1;
wait(5);
p=p+1;
wait(5);

Text.tonyu
extends TextChar;
$score=0;
while(1) {
  text="Score:"+$score;
  update();
}

このチュートリアルはTonyuチュートリアルのシューティングを作成された方を対象にしています。
まだ作成されていない方は、チュートリアルのシューティングサンプルを作成されてから閲覧されることを強くお勧めします。

それでは、まず貫通してしまう弾を貫通できなくするようにしましょう。

前  トップ