#東方弾幕風
#Title[一輪通常２]
#Text[test]
#ScriptVersion[2]

script_enemy_main {
	let name	= "「」";

	// 初期位置
	let xIni	= GetCenterX;
	let yIni	= GetClipMinY + 64+32;

	//shotall.png
	#include_function ".\lib_usershot.txt"
	//一輪の基本設定
	#include_function ".\lib\setting_itirin.txt"

	let D_RATE = 100;
	let D_WAIT = 260;

	@Initialize {
		SetLife(2200);
		SetTimer(32);
		SetDamageRate(5, 5);

		Ini_Graphic;

		TMain;
	}

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

		yield;
	}

	@DrawLoop {
		Draw_Itirin;
	}

	@Finalize {
		if (!IsTimeOut()) { makeTokutenItem(10); }
//		DeleteGraphic(imgBoss);
	}

	// メインタスク
	task TMain {
		yield;

		TRate;
		standBy;
		powerSave;

		//弾
		TShot;
	}

	//弾射出タスク
	task TShot()
	{
		loop
		{
			shot_lazershot(48, 0,   -90, 2.7, 4, US_RICE_S_AQUA, 10, 32, 7, 1);
			shot_lazershot(48, 180,  90, 2.7, 4, US_RICE_S_AQUA, 10, 32, 7, -1);
			shot_lazershot(48, 0, 180, 2.7, 4, US_RICE_S_PURPLE, 10, 32, 7, 1);
			
			moveBoss(30, 70, 15, 40, 20, 2, 64, 40, 150);
			
			wait(48);
			shot_lazershot(64, 0,  -90, 2.7, 4, US_RICE_S_BLUE, 10, 32, 7, 1);
			shot_lazershot(64, 180,  90, 2.7, 4, US_RICE_S_BLUE, 10, 32, 7, -1);
			shot_lazershot(48, 0, 180, 2.7, 4, US_RICE_S_PURPLE, 10, 32, 7, 1);
			wait(80);
		}
	}

	//一輪さん通常３風味
	task shot_lazershot(r, angle, a_offset, min_speed, max_speed, graphic, delay, rway, dway, muki)
	{
		let x = GetX;
		let y = GetY;
		ascent(let t in 0 .. rway)
		{
			let a = angle + t*360/rway*muki;
			ascent (let n in 0 .. dway) {
				let speed = min_speed + (max_speed-min_speed)/dway*(n+1);
				CreateShot01(x+r*cos(a), y+r*sin(a), speed, a+a_offset, graphic, delay);
			}
			yield;
			StopSE(SE_SHOT);
			PlaySE(SE_SHOT);
		}
	}
}
