#TouhouDanmakufu
#Title[Nonspell 1 Hard]
#Text[First Nonspell Hard]
#Player[FREE]
#ScriptVersion[2]
#BackGround[User(.\moon.png, 0, 0)]
script_enemy_main {
    let ImgBoss = "script\img\ExRumia.png";
	#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh"
    let frame = 0;
	let shot = GetCurrentScriptDirectory~"shot.wav";
    @Initialize {
        SetLife(2000);
        SetTimer(50);
	LoadSE(shot);
	shotinit;
	SetEnemyMarker(true);
	SetInvincibility(180);
	SetDamageRate(100, 100);
        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
       

        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
        SetGraphicRect(0, 0, 64, 64);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);

        if(frame == 121){
	

	let a   = 0.5;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3.5, a+GetAngleToPlayer, BLUE02, 0);
            a += 360/num;
		frame=-10;
		
}
        }

if(frame == 20){
	

	let a   = 0.5;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3.5, a+GetAngleToPlayer, BLUE02, 0);
            a += 360/num;
		PlaySE(shot);
		
}
        }

if(frame == 40){
	

	let a   = 0.5;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3.5, a+GetAngleToPlayer, BLUE02, 0);
            a += 360/num;
		
		
}
        }

if(frame == 60){
	

	let a   = 2;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3.5, a+GetAngleToPlayer, BLUE02, 0);
            a += 360/num;
		
		PlaySE(shot);
}
        }

if(frame == 80){
	

	let a   = 2;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3.5, a+GetAngleToPlayer, BLUE02, 0);
            a += 360/num;
		
		
}
        }

if(frame == 100){
	

	let a   = 2;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3.5, a+GetAngleToPlayer, BLUE02, 0);
            a += 360/num;
		
		
}
        }


if(frame == 60) {

SetMovePosition03(rand(50, 15)+GetX, rand(-10, -20)+GetY, 3, 1.5); 

}

if(frame == 20){

	let a   = 4;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2, a+GetAngleToPlayer, YELLOW02, 0);
            a += 360/num;
        PlaySE(shot);
    }
	}

if(frame == 40){

	let a   = 4;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2, a+GetAngleToPlayer, YELLOW02, 0);
            a += 360/num;
        PlaySE(shot);
    }
	}

if(frame == 60){

	let a   = 4;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2, a+GetAngleToPlayer, YELLOW02, 0);
            a += 360/num;
        PlaySE(shot);
    }
	}

if(frame == 80){

	let a   = 4;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 1.5, a+GetAngleToPlayer, YELLOW02, 0);
            a += 360/num;
        PlaySE(shot);
    }
	}

if(frame == 100){

	let a   = 4;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2, a+GetAngleToPlayer, YELLOW02, 0);
            a += 360/num;
        PlaySE(shot);
    }
	}

if(frame == 120){

	let a   = 4;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2, a+GetAngleToPlayer, YELLOW02, 0);
            a += 360/num;
        PlaySE(shot);
    }
	}

if(frame == 120) {

SetMovePosition03(rand(-50, -15)+GetX, rand(10, 20)+GetY, 3, 1); 

}

frame++;

}
    @DrawLoop {
       SetTexture(ImgBoss);
               SetTexture(ImgBoss);
                SetRenderState(ALPHA);
                SetAlpha(255);  
                SetGraphicScale(1,1);
                SetGraphicAngle(0,0,0);

                if(GetSpeedX==0){
                         SetGraphicRect(0,0,64,64); }
                        
 
                if(GetSpeedX>0){
                        SetGraphicRect(190, 126, 256, 64);
			}
 
                if(GetSpeedX<0){
                        
                        SetGraphicRect(128,128,186,64); }
                      
 
                DrawGraphic(GetX,GetY);
	


    }

    @Finalize {
        DeleteGraphic(ImgBoss);
    }
}
