#TouhouDanmakufu
#Title[speel 3]
#Text[SP3LLVARD THREEE]
#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, "Insanity Sign "\""Abandon Lonliness"\", GetCurrentScriptDirectory~"cutin.png", 0, 0, 384, 384);
		SetScore(10000000);
	}
	let frame = -120;
	let frame2 = -120;
	let frame3 = -60;
	let angle = 0;
	@MainLoop {
		SetCollisionA(GetX, GetY, 50);
		SetCollisionB(GetX, GetY, 50);
		if(frame == -120) {
			SetMovePosition02(GetCenterX, GetCenterY-50, 15);
			Concentration01(120);
		}
		frame++; frame2++; frame3++;
		if(frame >= 4) {
			loop(27) {
				CreateShot01(GetX+100*cos(angle), GetY+100*sin(angle), 4, angle, Knife03, 10);
				angle+=360/27;
			}
			angle+=4; while(angle > 360) { angle-=360; }
			frame = 0;
		}
		if(frame2 >= 240) {
			SetMovePosition02(GetCenterX+rand(-100, 100), GetCenterY/2+rand(-50, 50), 150);
		frame2 = 0; }
		if(frame3 >= 2) {
			let angle2 = GetAngleToPlayer;
			loop(6) {
				CreateShot01(GetX, GetY, 1, angle2, Amulet02, 10);
				angle2+=360/6;
			}
			frame3 = 0;
		}
	}
	@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);
	}
}