#TouhouDanmakufu
#Title[soell 2]
#Text[SP3LLVARD TO]
#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 "\""Wild Poltergeist"\", GetCurrentScriptDirectory~"cutin.png", 0, 0, 384, 384);
		SetScore(10000000);
	}
	let frame = -120;
	let frame2 = -120;
	let frame3 = -60;
	let angle = 0;
	let angle2 = GetAngleToPlayer;
	let angle3 = rand(0,360);
	let angle3Acc = 0;
	@MainLoop {
		SetCollisionA(GetX, GetY, 50);
		SetCollisionB(GetX, GetY, 50);
		if(frame == -120) {
			SetMovePosition02(GetCenterX, GetCenterY-50, 15);
			Concentration01(120);
		}
		frame++;
		if(frame >= 0) { frame2++; }
		if(frame2 >= 0) { frame3++; }
		if(frame >= 4) {
			loop(4) {
				CreateShot01(GetX, GetY, 5, angle, Small04, 10);
				angle+=360/4;
			}
			angle+=3; while(angle > 360) { angle-=360; }
			frame = 0;
		}
		if(frame2 >= 15) {
			loop(9) {
				CreateShot01(GetX, GetY, 3, angle2, GBar09, 10);
				angle2+=360/9;
			}
			angle2-=4; while(angle2 > 360) { angle2-=360; }
			frame2 = 0;
		}
		if(frame3 >= 2) {
			loop(2) {
				CreateShotA(0, GetX, GetY, 15);
				SetShotDataA(0, 0, 6, angle3, 1*sin(angle), -1/15, 3, Medium06);
				SetShotDataA(0, 90, 3, NULL, 0, 0, 0, Medium06);
				FireShot(0);
				angle3+=360/2;
			}
			angle3-=angle3Acc; angle3Acc+=1/5; while(angle3 > 360) { angle3-=360; } while(angle3Acc > 360) { angle3Acc-=360; }
			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);
	}
}