
	#Title[カッター]
	#Text[zako]
	#ScriptVersion[2]
	
	script_enemy_main
	{
        let img = "script\某クワガタ\ぶーめらん.png";
        let frame = 0;
        let aa=0;
        let aa2=0;
        let aa3=0;
        let X=GetX;
        let Y=GetY;
      LoadCommonData;
		@Initialize
		{ 
              SetLife(10000);
              LoadGraphic(img);
SetGraphicAngle(0,0,aa);
              SetTexture(img);  SetGraphicRect(0, 0, 64, 64);


             TMain;
		
		}
			
		@MainLoop
		{
    SetCollisionA(GetX, GetY, 0);
    SetCollisionB(GetX, GetY, 32);
    aa=aa+21;
SetGraphicAngle(0,0,aa);
   yield;


		}
		
		@DrawLoop
		{
		   DrawGraphic(GetX, GetY);
		}
			
		@Finalize
		{
  
		}
         task TMain{
               yield;
        
if(GetX<GetCenterX){
shot;
if(GetY<GetCenterY){
SetAngle(45);
SetSpeed(7);}
else{
SetAngle(315);
SetSpeed(7);
}
loop(4){
loop(5){yield;}
loop{yield;
if(GetX<GetClipMinX||GetX>GetClipMaxX||GetY<GetClipMinY||GetY>GetClipMaxY){SetAngle(GetAngleToPlayer);break;}

}}

}

else{
shot2;
if(GetY<GetCenterY){
SetAngle(135);
SetSpeed(7);}
else{
SetAngle(225);
SetSpeed(7);
}
loop(4){
loop(5){yield;}
loop{yield;
if(GetX<GetClipMinX||GetX>GetClipMaxX||GetY<GetClipMinY||GetY>GetClipMaxY){SetAngle(GetAngleToPlayer);break;}

}}
}
 SetMovePosition02(GetEnemyX,GetEnemyY, 30);
loop(30){yield;}
VanishEnemy;

                   }



	
task shot{
loop(90){

CreateShot02(GetX,GetY,4,aa2,0,0,ORANGE01,30);
CreateShot02(GetX,GetY,2,aa2+180,0,0,WHITE01,30);
aa2=aa2+45;
loop(5){yield;}
}


}
task shot2{
loop(90){

CreateShot02(GetX,GetY,4,aa2,0,0,BLUE01,30);
CreateShot02(GetX,GetY,2,aa2+180,0,0,GREEN01,30);
aa2=aa2+45;
loop(5){yield;}
}


}
}
