#TouhouDanmakufu
#Title[Machin et J64 NSC]
#Text[Non-spell de Machin et J64]
#Image[]
#BGM[script\DanMUku\Stage6\Stage6.mp3]
#Player[script\DanMUku\Joueur\KorA\KorHosik.txt, script\DanMUku\Joueur\KorB\KorB.txt, script\DanMUku\Joueur\KorC\KorC.txt]
#ScriptVersion[2]

script_enemy_main
{    
    let imgEnemy="script\DanMUku\Stage1\Image\Machin.png";
    let count=-100;

    let tir ="script\DanMUku\Stage1\Son\tir.wav";
    let z = 0;
    let w = 0.5;
    let angle = GetAngleToPlayer;
   @Initialize
   {
      LoadUserShotData("script\DanMUku\MUtir\MUtir.txt");
      LoadGraphic(imgEnemy);
      LoadSE(tir);
            SetLife(5000);
            SetTimer(40);
            SetInvincibility(60);
            SetEnemyMarker(true);
            SetMovePosition02(GetCenterX-100, GetCenterY - 100, 120);
	CreateEnemyFromScript("J64", GetCenterX+50, GetCenterY - 140, 0, 0, 0);
   }
   
   @MainLoop
   {
          SetCollisionA(GetX, GetY, 16);
        SetCollisionB(GetX, GetY, 16);

	if (count>0&&count%5==0) {
		PlaySE(tir);
		let a = angle;
		loop(7){
			CreateShot01(GetX+cos(a)*50, GetY+sin(a)*50, 2, a-30, 81, 10);
			a+=360/7;
		}
		angle+=20;
	}

count++;
yield;
}
   @Finalize
   {
      DeleteGraphic(imgEnemy);
   }

   @DrawLoop
   {
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetTexture(imgEnemy);
            SetGraphicRect(0,0,16*1.5,16*1.5);
            DrawGraphic(GetX,GetY+z);
     if(z==10){w=-0.5;}
     if(z==-10){w=0.5;}
z+=w;
	DrawText("Machin et J64", GetClipMinX+10, GetClipMinY+15, 12, 255);
   }

}

script_enemy J64
{    
    let imgEnemy2="script\DanMUku\Stage4\Image\j64.png";
    let count=-100;

    let angle = GetAngleToPlayer;
   @Initialize
   {
      LoadUserShotData("lib\MUtir\MUtir.txt");
      LoadGraphic(imgEnemy2);
		SetLife(1);
            SetInvincibility(60);
            SetEnemyMarker(true);
            SetMovePosition02(GetCenterX+100, GetCenterY - 100, 120);
   }
   
   @MainLoop
   {
          SetCollisionA(GetX, GetY, 16);
        SetCollisionB(GetX, GetY, 16);
	SetDamageRateEx(0,0,100,100);
	

	if (count>0&&count%5==0) {
		let a = angle;
		let g = 52;
		loop(7){
			CreateShot01(GetX+cos(a)*50, GetY+sin(a)*50, 2, a+30, g, 10);
			g++;
			a+=360/7;
		}
		angle-=20;
	}

count++;
yield;
   }
   @Finalize
   {
      DeleteGraphic(imgEnemy2);
   }

   @DrawLoop
   {
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetTexture(imgEnemy2);
            SetGraphicRect(0,0,36,43);
            DrawGraphic(GetX,GetY);
   }

}
