#TouhouDanmakufu
#Title[Lunar Grimoire "Eternal Star"]
#Text[What is an eternal moon good for? Surely nothing useful for Marisa.]
#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 bossflip = 0;
let ani = 0;

@Initialize{
	LoadStuff;
	SetLife(3000);
	SetInvincibility(180);
	SetTimer(90);
	SetScore(1000000);
	cutin("NAZRIN","Lunar Grimoire "\""Eternal Star"\",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(81,85,249);
	Concentration01(120);
	SetColor(255,255,255);
	PlaySE(Charge);
	Wait(120);
	CreateEnemyFromFile(csd~"KaguFam.txt", GetCenterX, GetCenterY-60, 0, 0, 0);
	CreateEnemyFromFile(csd~"KaguFam.txt", GetCenterX+30, GetCenterY-56, 0, 0, 1);
	CreateEnemyFromFile(csd~"KaguFam.txt", GetCenterX-30, GetCenterY-56, 0, 0, -1);
	CreateEnemyFromFile(csd~"KaguFam.txt", GetCenterX+60, GetCenterY-48, 0,	0, 2);
	CreateEnemyFromFile(csd~"KaguFam.txt", GetCenterX-60, GetCenterY-48, 0, 0, -2);
	CreateEnemyFromFile(csd~"KaguFam.txt", GetCenterX+90, GetCenterY-32, 0, 0, 3);
	CreateEnemyFromFile(csd~"KaguFam.txt", GetCenterX-90, GetCenterY-32, 0, 0, -3);
	PlaySE(Familiar);
	RainbowSpiralLeft(1);
	RainbowSpiralRight(2);
	}
task RainbowSpiralLeft(speed){
	let angle=90;
	loop{
		ascent(i in 0..10){
			CreateShot01(GetX,GetY,2,angle+36*i,25+i,0);
			}
		angle+=12*speed;
		Wait(10);
		}
	}
task RainbowSpiralRight(speed){
	let angle=90;
	loop{
		ascent(i in 0..10){
			CreateShot01(GetX,GetY,2,angle+36*i,25+i,0);
			}
		angle=angle-10*speed;
		Wait(10);
		}
	}
@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);}
	SetColor(255,255,255);
	SetGraphicAngle(0,0,0);
	SetTexture(Marisprite);
	SetGraphicRect(BR[0],BR[1],BR[2],BR[3]);
	DrawGraphic(GetX,GetY);
	}

@BackGround{
	SpellBG;
	}
@Finalize{
	DeleteStuff;
	CaptureBonus;
	}
}