#TouhouDanmakufu
#Title[Boulder Sign "Landslide"]
#Text[I wanted to make a card that shows the randomness of nature. She's going easy on you, though.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let ImgBoss = "script\img\ExRumia.png";
	#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh"
	let background = GetCurrentScriptDirectory~"patchybackground.png";
    let frame = -120;
    let shot = GetCurrentScriptDirectory~"shot.wav";
    @Initialize {
        SetLife(3400);
	LoadSE(shot);
        SetTimer(50);
	shotinit;
        SetScore(1000000);
	SetDamageRate(150,50);
	SetInvincibility(180);
        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        CutIn(KOUMA, "Boulder Sign "\""Landslide"\", 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(0, 25);
        let num = 12; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3.5, a+GetAngleToPlayer, RED03, 0);
            a += 360/num;
	PlaySE(shot);
}

}

if(frame == 30){

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

}


if(frame == 20) {
            CreateShot01(GetX, GetY +20*sin(60), 3, GetAngleToPlayer, WHITE03, 0);
           
        }



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