	#e
	#Title[Xubhu[CpNgv]
	#Text[ƕX̏Ռ]
	#Image[]
	#ScriptVersion[2]
	#BGM[.\BGM3.mp3]
	#Player[FREE]
	script_enemy_main
	{
		let c01=0;
		let c02=0;
		let c03=0;
		let cx=GetCenterX();
		let cy=GetCenterY();
    		let angle=0;
		let angleBase = 90;
		let mode=1;
		@Initialize
		{
			CutIn(YOUMU, "Xubhu[CpNgv", "", 0, 0, 0, 0);
			SetLife(4000);
			SetMovePosition02(cx,cy,50);
			SetTimer(30);
        		SetScore(4000000);
			SetGraphicRect(1,1,48,48);
			LoadGraphic("script\img\2127578.png");
		}
			
		@MainLoop
		{
			if(c01==60) {
            		if(mode==1){nway(angleBase,10,36,RED01,1);
          		angleBase+=5;
			}
			if(mode==2){nway(angleBase,10,36,RED01,2);
          		angleBase-=5;
			}
			c01=50;
			}
			
			if(50<=c01){
			loop(3){
			CreateShot01(GetX,GetY,2,angle,BLUE12,0);
			angle+=120;
			}
			if(mode==1){angle+=10;}
			if(mode==2){angle-=10;}
			}
			
			if(c03==150){
			CreateShot01(GetX,GetY,2,GetAngleToPlayer(),RED03,0);
			c03=0;
			}	

				SetCollisionA(GetX(),GetY(),32);
				SetCollisionB(GetX(),GetY(),24);
				if(150>=c02){mode=1;}
				if(150<=c02){mode=2;}
				if(c02==300){c02=0;}
				c01++;
				c02++;
				c03++;
		}

		@DrawLoop
		{
			
			SetTexture("script\img\2127578.png");
			DrawGraphic(GetX(),GetY());
		}
		
		@Finalize
		{
			loop(24) {
        		let x = GetX + rand(-64, 64);
       	 		let y = GetY + rand(-64, 64);
        		CreateItem(ITEM_SCORE, x, y);
			}
			DeleteGraphic("script\img\2127578.png");
			}
			 
			function nway(dir,way,span,color,mode) {
        		let radius=50;
       			let angle=dir-(way-1)/2*span;

        		loop(way) {
            		let x=GetX+offsetX(radius,angle);
            		let y=GetY+offsetY(radius,angle);

            		
            		if(mode==1){
			CreateShot01(x,y,3,angle+90,color,0);
			angle+=span;
			}
        		if(mode==2){
			CreateShot01(x,y,3,angle-90,color,0);
			angle-=span;
			}
			}
    		}

    		function offsetX(radius,angle){
        		return radius*cos(angle);
   			}

    		function offsetY(radius,angle){
        		return radius*sin(angle);
    			}

		}
	}
  
