#TouhouDanmakufu
#Title[attak 4]
#Text[ATATAK FOIR]
#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(35);
		ShotInit;
		LoadGraphic(bossImage);
		LoadGraphic(bossBack);
	}
	let frame = -120;
	let frame2 = -120;
	let angle = rand(0,360);
	@MainLoop {
		SetCollisionA(GetX, GetY, 50);
		SetCollisionB(GetX, GetY, 50);
		if(frame == -120) {
			SetMovePosition02(GetCenterX, GetCenterY/2, 15);
			Concentration01(120);
		}
		frame++;
		frame2++;
		if(frame >= 4) {
			CreateShotA(0, GetX, GetY, 10);
			SetShotDataA(0, 0, 6, angle, 2, -1/10, 1, Bubble01);
			SetShotDataA(0, 60, 1, NULL, -1, 1/10, 5, NULL);
			let angle2 = -angle;
			loop(3) {
				CreateShotA(1, 0, 0, 20);
				SetShotDataA(1, 0, 6, angle2, 0, -1/5, 2, GArrow04);
				AddShot(10, 0, 1, 0);
				angle2+=360/3;
			}
			FireShot(0);
			angle+=28; while(angle >= 360) { angle-=360; }
			frame = 0;
		}
		if(frame2 >= 150) {
			SetMovePosition02(GetCenterX+rand(-100, 100), GetCenterY-50+rand(-150, 150), 60);
		frame2 = 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);
	}
}