#TouhouDanmakufu
#Title[Maid Secret Skill "Knife Cage"]
#Text[Everything is a maid secret skill for that pad lady.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let ImgBoss = "script\img\ExRumia.png";
	let shot = GetCurrentScriptDirectory~"shot.wav";
    let frame = -120;
	let shot2 = GetCurrentScriptDirectory~"shot2.wav";
	#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh"

	let background = GetCurrentScriptDirectory~"patchybackground.png";
    @Initialize {
        SetLife(3500);
        SetTimer(50);
        SetScore(1000000);
	SetInvincibility(180);
	SetDamageRate(100,10);
	LoadSE(shot);
	LoadSE(shot2);
	LoadGraphic(background);
	shotinit;
        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        CutIn(KOUMA, "Cornered "\""Creatures of the Night"\", GetCurrentScriptDirectory~"rumia.png", 0, 0, 128, 256);
        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
        SetGraphicRect(0, 0, 64, 64);
    }

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

        if(frame == 61) {
            CreateShot01(GetX, GetY, 5.5, GetAngleToPlayer, PURPLE32, 0);
            frame = 0;
	PlaySE(shot)
        }


if(frame == 30) {
            CreateShot01(GetX, GetY, 5.5, 2.5+GetAngleToPlayer, PURPLE32, 0);
           PlaySE(shot);
        }

if(frame == 30) {
            CreateShot01(GetX, GetY, 5.5, -2.5+GetAngleToPlayer, PURPLE32, 0);
           PlaySE(shot);
        }

if(frame == 60){

	let a   = 10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
}
}
if(frame == 60){

	let a   = -10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
            
PlaySE(shot2)
}

}

if(frame == 10){

	let a   = -10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
            
a += 360/num;
}

}

if(frame == 10){

	let a   = 10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
           

}

}
if(frame == 20){

	let a   = 10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
            PlaySE(shot2);

}

}

if(frame == 20){

	let a   = -10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
            

}

}
if(frame == 30){

	let a   = -10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
            

}

}

if(frame == 30){

	let a   = 10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
            PlaySE(shot2);

}

}

if(frame == 40){

	let a   = 10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
            PlaySE(shot2);

}

}

if(frame == 50){

	let a   = -10;
        let num = 24; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 2.5, a+90, WHITE32, 0);
a += 360/num;
            PlaySE(shot2);

}

}
        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);
    }
}
