script_enemy_main
{    
    let imgEnemy="script\DanMUku\Stage6\Image\nuage.png";
    let count=-40;
    let a=0;
    let b=25;
    let y = 0;
    let munch ="script\DanMUku\Stage1\Son\muncher.wav";
    let x = GetX;
    let y = GetY;
    let dir = 0.5;

	function OnScreen() {
		return GetX>GetClipMinX&&GetX<GetClipMaxX&&GetY>GetClipMinY&&GetY<GetClipMaxY;
	}

   @Initialize
   {
      LoadUserShotData("script\DanMUku\MUtir\MUtir.txt");
      LoadGraphic(imgEnemy);
      LoadSE(munch);
            SetLife(150); 
   }
   
   @MainLoop
   {
          SetCollisionA(GetX, GetY, 16);
        SetCollisionB(GetX, GetY, 8);
if(count%10==0)
{
	if(a==78)
	{
		a=0;
		b=25;
	}
	else
	{
		a+=26;
		b+=26;
	}


}

if (count%100==0&&count<800) {
	SetAngle(90);
	SetSpeed(0.5);
	let angle = 0;
	PlaySE(munch);
	loop(4) {
		CreateShot01(GetX, GetY, 3, angle, 29, 0);
		angle+=90;
	}
}

if (count%100==50&&count<800) {
	SetAngle(0);
	SetSpeed(dir);
	dir = dir*-1;
	let angle = 45;
	PlaySE(munch);
	loop(4) {
		CreateShot01(GetX, GetY, 3, angle, 28, 0);
		angle+=90;
	}
}

if (count==800) {
	SetSpeed(-3);
}

count++;
yield;
   }
   @Finalize
   {
CreateItem(ITEM_SCORE, rand(GetX-10, GetX+10), rand(GetY-10, GetY+10));  
CreateItem(ITEM_SCORE, rand(GetX-10, GetX+10), rand(GetY-10, GetY+10));  
CreateItem(ITEM_SCORE, rand(GetX-10, GetX+10), rand(GetY-10, GetY+10));   
}
   
   @DrawLoop
   {

	if (x>GetX) {
		SetGraphicAngle(180, 0, 0);
	}
	else {
		SetGraphicAngle(0, 0, 0);
	}
	if (y<GetY) {
		SetGraphicRect(a, 18, b, 42);
	}
	else {
		SetGraphicRect(a, 0, b, 17);
	}

	x = GetX;
	y = GetY;
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetTexture(imgEnemy);
            DrawGraphic(GetX,GetY);
   }


}
