#TouhouDanmakufu
#Title [NonSpell 2 Normal]
#Text [NonSpell 2]
#BGM[.\]
#PlayLevel[NORMAL]
#Player[FREE]
#ScriptVersion [2]
script_enemy_main {
#include_function"lib\function_cutin.txt";
#include_function"lib\SnowFunc.txt";
	#include_function ".\lib\lib_anime_yumemi.txt"; 		// including library
	let ImgBoss = GetCurrentScriptDirectory~"yumemid.png"; 	// declaring the boss image (sprited by Jhonny Walker);
	LoadGraphic(ImgBoss); 				// loading the boss sprite

let frame = 0;
let frame2 = 0;
let i = 0;
let ii = 0;
let Name       = "Missing "\""The Land the World Lost"\";
    let CSD        = GetCurrentScriptDirectory;
    let ShotData   = CSD ~ "KIKISHOT.txt";
    let cutinImg   = CSD ~ "Tanioka.png";
    let var1 = 0;
    let var2 = 0;
    let var3 = 0;
    let var4 = 0;
let dir = 0;
let count = 0;
let dir2 = 0;
let count2 = 0;
let SpellBG1 = CSD~"img/BG.png";
let SpellBG2 = CSD~"img/BG2.png";
let bgalpha = 0;
let bgangle = 0;
    @Initialize {
LoadGraphic(SpellBG1);
LoadGraphic(SpellBG2);
	SetInvincibility(90);
	PlayMusic("script\MUSIC\TH0X05.mp3");
	LoadGraphic(cutinImg);
        SetX(GetX);
        SetY(GetY);
	Concentration03(90);
        SetLife(600);
        SetDamageRate(20, 30);
        SetTimer(30);
        SetEnemyMarker(true);
	Concentration03(90);
        LoadGraphic("script\img\TANIOKA.png");
        SetTexture("script\img\TANIOKA.png");
        SetGraphicRect(0, 0, 63, 63);
	SetMovePosition02(GetCenterX, GetCenterY, 40);
        LoadUserShotData(ShotData);
        InitializeAction();
	
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
        yield;
	if(frame==40){
	i+=5;
	CreateShot02(GetX, GetY, 3, i, -0.5, 1, PURPLE23, 0);

	CreateShot02(GetX, GetY, 3, 180 + i, -0.5, 1, PURPLE23, 0);

	CreateShot02(GetX, GetY, 3, 90 + i, -0.5, 1, PURPLE23, 0);

	CreateShot02(GetX, GetY, 3, 270 + i, -0.5, 1, PURPLE23, 0);

	frame = 34;
	}
	if(frame2==10){
	var1+=1;
	i+=5;
	SetMovePosition02(GetCenterX + 140*cos(0 - i), GetCenterY + 70*sin(0 - i), 40);
	PlaySE("script\se\se_tan01.wav");
	frame2 = 0;
	}

	
 	frame++;
	frame2++;
		}

    @DrawLoop {
if (bgalpha < 255){bgalpha += 5;}
//bgangle += 0.9;

SetAlpha(bgalpha);
//SetGraphicScale(2.2,2.2);	//The background is scaled up so it can fill the whole screen.
SetColor(255,255,255);
SetGraphicRect(0,0,563,563);

SetTexture(SpellBG1);
DrawGraphic(GetCenterX,GetCenterY);

SetTexture(SpellBG2);
SetGraphicAngle(0,0,bgangle);
DrawGraphic(GetCenterX,GetCenterY);
//Remember to set everything back to default before drawing something else (spinning Reimu?!).
        	if(GetSpeedX()>0){SetAction(ACT_MOVE,0)}		// * Init move for right - keep 0 for better usage    
	if(GetSpeedX()<0){SetAction(ACT_MOVE,0)}		// * Init move for left - keep 0 for better usage
	DrawBoss(ImgBoss);				// * call this to draw the boss

    }

    @Finalize {
        
        DeleteGraphic(ImgBoss); 				// * Delete the image 
DeleteGraphic(SpellBG1);
DeleteGraphic(SpellBG2);
loop(15){
            CreateItem(ITEM_SCORE,GetX+rand(-50,50),GetY+rand(-50,50));
        }
    }


}
