#TouhouDanmakufu
#Title[Hakurei "Smell How You want!"]
#Text[Raymoo?]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let ImgBoss = "script\img\ExRumia.png";
#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh"
	let shot = GetCurrentScriptDirectory~ "shot.wav";
    let frame = -120;
let background = GetCurrentScriptDirectory~"patchybackground.png";
    @Initialize {
        SetLife(3200);
        SetTimer(70);
	LoadSE(shot);
        SetScore(1000000);
	SetInvincibility(180);
	shotinit;
        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        CutIn(KOUMA, "Hakurei "\""Smell how you want!"\", GetCurrentScriptDirectory~"rumia.png", 0, 0, 128, 256);
	LoadGraphic(background);
        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
        SetGraphicRect(0, 0, 64, 64);
	SetDamageRate(90, 0);
    }

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

        if(frame == 60) {
            CreateShot01(GetX, GetY, 5, GetAngleToPlayer, SP04, 0);
	PlaySE(shot)
            
        }

	if(frame == 121) {
            CreateShot01(GetX, GetY, 5, GetAngleToPlayer, SP05, 0);
            frame=0
        }

	if(frame == 60){

	let a   = 0;
        let num = 60; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 1.5, a+70, RED56, 0);
            a += 360/num;

}
}
if(frame == 30){

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

if(frame == 60) {

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

}

if(frame == 120) {

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

}
if(frame == 90){

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

if(frame == 120){

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

if(frame == 20){

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

        frame++;
	

    }

    @DrawLoop {
        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);
    }

let y = 0;

@BackGround{
   SetTexture(background);
   SetGraphicRect(0, 0 - y, 512, 512 - y);
   DrawGraphic(GetCenterX, GetCenterY);
   y++;
}

    @Finalize {
        DeleteGraphic(ImgBoss);
    }




}
