#TouhouDanmakufu
#Title[4 psell]
#Text[SPELLCXARD FUOR]
#Player[FREE]
#BGM[.\micro.mp3]
#BackGround[User(.\backReg.png, 9, 15)]
#ScriptVersion[2]

script_enemy_main {
	let bossImage = GetCurrentScriptDirectory~"sprite.png";
	let bossBack = GetCurrentScriptDirectory~"back.png";
	#include_function ".\shot_replace.dnh";
	@Initialize {
		SetLife(4000);
		SetTimer(50);
		ShotInit;
		LoadGraphic(bossImage);
		LoadGraphic(bossBack);
		CutIn(KOUMA, "Chaos Sign "\""Ghosty Trickster"\", GetCurrentScriptDirectory~"cutin.png", 0, 0, 384, 384);
		SetScore(10000000);
	}
	let frame = -120;
	let frame2 = -120;
	let angle = 0;
	let speed = 2;
	@MainLoop {
		SetCollisionA(GetX, GetY, 50);
		SetCollisionB(GetX, GetY, 50);
		if(frame == -120) {
			SetMovePosition02(GetCenterX, GetCenterY-50, 15);
			Concentration01(120);
		}
		frame++; frame2++;
		if(frame % 10 == 0) {
			if(frame <= 120) {
				loop(6) {
					CreateShot01(GetX+rand(-150, 150), GetY+rand(-50, 50), rand(3, 5), 90+rand(-3,3), Knife04I, 10);
					CreateShot01(GetX+rand(-150, 150), GetY+rand(-50, 50), rand(3, 5), 270+rand(-3,3), Knife04I, 10);
				}
			}
			if(frame > 120) {
				loop(37) {
					CreateShot01(GetX, GetY, speed, angle, Bullet202, 10);
					angle+=360/37;
				}
				angle+=7; speed+=1/6;
			}
		}
		if(frame == 300) {
			speed = 2;
			frame = 0;
		}
		if(frame2 >= 120) {
			SetMovePosition02(GetCenterX+rand(-175, 175), GetCenterY/2+rand(0, 100), 120);
		frame2 = 0; }
		if(frame2 == 0 || frame2 == 30 || frame2 == 60 || frame2 == 90) {
			let angle = rand(0,360);
			loop(67) {
				CreateShot01(GetX, GetY, 5, angle, Small06, 10);
				angle+=360/67;
			}
		}
	}
	@DrawLoop {
		SetTexture(bossImage);
		SetGraphicRect(0, 0, 128, 128);
		DrawGraphic(GetX, GetY);
		DrawText("Kana Anaberal", 40, 30, 12, 255);
	}
	@BackGround {
		SetTexture(bossBack);
		SetGraphicRect(0, 0, 384, 448);
		DrawGraphic(GetCenterX, GetCenterY);
	}
	@Finalize {
		DeleteGraphic(bossImage);
		DeleteGraphic(bossBack);
	}
}