#TouhouDanmakufu
#Title[Cherry Grimoire "Netherworld Star -Maniac-"]
#Text[Such a long winter can't do well to your health.]
#BackGround[User(.\img\BG.png,0,0)]
#PlayLevel[Normal]
#Player[FREE]
#BGM[.\bgm.mp3]
#ScriptVersion[2]
script_enemy_main	
{
#include_function ".\function_cutin.txt"
#include_function ".\lib.txt"
let bgalpha = 0;	
let bgangle = 0;	
let Yuyufan = csd ~ "img/yuyuko.png";
let bossflip = 0;
let ani = 0;
let wide=0;
let tall=0;

@Initialize{
	LoadStuff;
	LoadGraphic(Yuyufan);
	SetLife(3000);
	SetInvincibility(180);
	SetTimer(90);
	SetScore(1000000);
	cutin("NAZRIN","Cherry Grimoire "\""Netherworld Star -Maniac-"\",Maricutin,0,0,256,512);
	SetEffectForZeroLife(60,0,0);
	SetMovePosition02(GetCenterX,GetCenterY-120,60);
	LoadUserShotData(GetCurrentScriptDirectory~"Shot.txt");
	MainTask;	
	Timer;
	MoveAnimation;
	}
task MainTask{
	Wait(60);
	SetColor(235,95,235);
	Concentration01(120);
	SetColor(255,255,255);
	PlaySE(Charge);
	Wait(120);
	FanSummon;
	SmallStarBarrage;
	Wait(120);
	loop{
		BigStar;
		randMove;
		Wait(150);
		}
	}
task FanSummon{
	tall+=0.025;
	while (wide<=1){
		wide+=0.05;
		yield;
		}
	PlaySE(Boon);
	while(tall<=1){
		tall+=0.05;
		yield;
		}
	}
task randMove{ SetMovePosition03(rand(GetClipMinX,GetClipMaxX), rand(GetClipMinY,200), 2, 2);}
task SmallStarBarrage{
	loop{
		SmallStar(rand(0,400), rand(0,200));
		Wait(1);
		}
	}
task SmallStar (x,y){
	CreateShot01(x,y,4,90,147,10);
	CreateShot01(x,y,4,270,147,10);
	}
task BigStar{
	ascent(i in 1..4){
		CreateEnemyFromFile(csd~"YuyuFamL.txt", GetX, GetY, 2, GetAngleToPlayer+60+120*i, 1);
		}
		PlaySE(Shot1);
	}
@MainLoop{
	SetCollisionA(GetX,GetY,48);
	SetCollisionB(GetX,GetY,32);
	yield;
	}
@DrawLoop{
	DrawName("Marisa Kirisame");
	SetAlpha(255);
	if (bossflip==0){SetGraphicScale(1,1);}
	if (bossflip==1){SetGraphicScale(-1,1);}
	SetTexture(Yuyufan);
	SetGraphicRect(0, 0, 510, 256);
	SetAlpha(255);
	SetRenderState(ALPHA);
	SetGraphicScale(wide,tall);
	DrawGraphic(GetX,GetY);
	
	SetColor(255,255,255);
	SetGraphicAngle(0,0,0);
	SetTexture(Marisprite);
	SetGraphicScale(1,1);
	SetGraphicRect(BR[0],BR[1],BR[2],BR[3]);
	DrawGraphic(GetX,GetY);
	}

@BackGround{
	SpellBG;
	}
@Finalize{
	DeleteStuff;
	DeleteGraphic(Yuyufan);
	CaptureBonus;
	}
}