#TouhouDanmakufu
#Title[Chilling Cold "Blizzard"]
#Text[Snorunt used blizzard!]
#Player[FREE]
#ScriptVersion[2]
#BackGround[User(.\patchybackground.png, 0, 3)]
script_enemy_main {
    let ImgBoss = "script\img\ExRumia.png";
	#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh"
    let frame = -120;
	let shot = GetCurrentScriptDirectory~"shot.wav";
	let powerup = GetCurrentScriptDirectory~"shot2.wav";
	let background = GetCurrentScriptDirectory~"patchybackground.png";

    @Initialize {
        SetLife(4000);
        SetTimer(50);
        SetScore(1000000);
	SetInvincibility(180);
	Concentration02(10000);
	SetDamageRate(155,10);
	shotinit;
        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        CutIn(KOUMA, "Chilling Cold "\""Blizzard"\", GetCurrentScriptDirectory~"rumia.png", 0, 0, 128, 256);
	LoadGraphic(background);
        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
        SetGraphicRect(0, 0, 64, 64);
    }


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

        

if(frame == 10){

	let a   = rand(15, 0);
        let num = 22; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 1.30, a+GetAngleToPlayer, WHITE01, 0);
            a += 360/num;

}
}
if(frame == 30){

	let a   = rand(0, 90);
        let num = 22; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3, a+GetAngleToPlayer, WHITE01, 0);
            a += 360/num;
		
}

}
if(frame == 50){

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

if(frame == 21){

	let a   = rand(0,8);
        let num = 42; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 1, a+GetAngleToPlayer, WHITE05, 0);
            a += 360/num;
		
		PlaySE(powerup);
		
		
}
}






if(frame == 20) {
	
            CreateShot01(GetX, GetY, 2.75, GetAngleToPlayer, WHITE02, 0);
          
        
	}
if(frame == 20) {
	
            CreateShot01(GetX, GetY, 2.75, 3.9+GetAngleToPlayer, WHITE02, 0);
          
        
	}
if(frame == 20) {
	
            CreateShot01(GetX, GetY, 2.75, -3.9+GetAngleToPlayer, WHITE02, 0);
          
        
	}
if(frame == 20) {
		let a   = -90;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
	loop(num)
	{
            CreateShot01(GetX, GetY, rand(2.75, 2.7), a+GetAngleToPlayer, WHITE02, 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);
    }
}
