script_enemy_main
{    
    let imgEnemy="script\DanMUku\Stage6\Image\boule.png";
    let count=0;
    let angle = 90;
    let munch ="script\DanMUku\Stage1\Son\muncher.wav";
    let longueur=0;
    let x=0;
    let y =GetClipMinY;
    let change = -(GetArgument^(-0.5))*6;

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

   @Initialize
   {
      LoadUserShotData("script\DanMUku\MUtir\MUtir.txt");
      LoadGraphic(imgEnemy);
      LoadSE(munch);
            SetLife(2000); 
	x=GetX;
   }
   
   @MainLoop
   {
          SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX-15*cos(angle), GetY-15*sin(angle), 12);

	

	if (count==GetArgument) {
		SetSpeed(0);
	}

	if (count>GetArgument&&count<1200) {
		SetX(x+cos(angle)*longueur);
		SetY(y+sin(angle)*longueur);
		angle+=change;
		if (angle>150) {
			change=-(longueur^(-0.5))*6;
			PlaySE(munch);
			let ang = angle;
			loop(longueur/5) {
				CreateShot01(GetX-15*cos(angle), GetY-15*sin(angle), 3, ang, YELLOW02, 0);
				ang-=360/(longueur/5);
			}
		}
		if (angle<30) {
			change=(longueur^(-0.5))*6;
			PlaySE(munch);
			let ang = angle;
			loop(longueur/5) {
				CreateShot01(GetX-15*cos(angle), GetY-15*sin(angle), 3, ang, YELLOW02, 0);
				ang+=360/(longueur/5);
			}
		}
		if (count%10==0) {
			CreateShot02(GetX-15*cos(angle), GetY-15*sin(angle), 0, angle, 0.1, 2, RED05, 0);
		}
	}

	if (count<GetArgument) {
		longueur++;
	}


	if (count>1200) {
		SetAngle(angle);
		SetSpeed(GetSpeed+0.1);
		x=GetX-cos(angle)*longueur;
		y=GetY-sin(angle)*longueur;
	}


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
   {

	SetGraphicRect(0, 174-longueur, 29, 174);
	SetGraphicAngle(0, 0, angle-90);
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetTexture(imgEnemy);
            DrawGraphic(x+cos(angle)*longueur*0.5,y-5+sin(angle)*longueur*0.5);
   }


}
