#TouhouDanmakufu
#Title[nn spell 2]
#Text[GRATE DANMAKOO]
#Player[REIMU]
#ScriptVersion[2]
#PlayLevel[LUNATIC]

script_enemy_main{

	let D	= GetCurrentScriptDirectory;
	let imgBoss = D ~ ".\ReIMu.png";
	let shot = D ~ "supershot.txt";
	let s1 = D ~ "Shot.wav";
	let slide = 0;

	@Initialize{
		SetLife(1500);
		SetTimer(53);
		SetEnemyMarker(true);
		LoadGraphic(imgBoss);
		SetInvincibility(120);
		LoadSE(s1);	
		fire;
		movement;
		LoadUserShotData(shot); 
	}

	@MainLoop{
		SetCollisionA(GetX,GetY,32);
		SetCollisionB(GetX,GetY,16);
		yield;
	}

	@DrawLoop{
		SetTexture(imgBoss);
		SetRenderState(ALPHA);
		SetAlpha(255);
		SetGraphicRect(0,0,110,110);
		SetGraphicScale(0.7,0.7);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetX,GetY);
	}

	@BackGround{}
task movement{
	loop{
		SetMovePosition01(rand(GetClipMaxX,GetClipMinX),rand(GetClipMaxY,GetClipMinY),10);
		wait(7);
		PlaySE(s1);
		}
	}
	task fire{
		let dir = 0;
		loop{
		loop(36){CreateShot01(GetEnemyX, GetEnemyY, 5, dir, 97, 0); dir+=11.25; }
			dir += rand(5,10);
			wait(4);
		}}
	function wait(w){loop(w){yield;}}
}