
#Title[アリス通常２]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
	#include_function ".\弾幕集.txt"

	@Initialize{
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(5200);
	SetTimer(39);
	SetDamageRate(150,30);

	LoadGraphic(imgboss2);
	SetTexture(imgboss2);
	SetGraphicRect(0,0,127,127);
	Shot(0);
	}

	@MainLoop{
	ChackBonus;
	SetCollisionA(GetX,GetY,24);
	SetCollisionB(GetX,GetY,24);
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	MasicPointAddNormal(3);
	DeleteGraphic(imgboss2);
	}

	task Move(){
	loop{
	yield;
	}
	}

	task Shot(level){
	function Wait(time){loop(time){yield;}}

	task LoopShot(x,y,speed,angle,angleadd,bullet,deley){
	let obj = Obj_Create(OBJ_SHOT);
	let i = 1;
	Obj_SetX(obj, x);
	Obj_SetY(obj, y);
	Obj_SetSpeed(obj, speed);
	Obj_SetAngle(obj, angle);
	ObjShot_SetGraphic(obj, bullet);
	ObjShot_SetDelay(obj, deley);
	loop(30){loop(i){yield;}
	Obj_SetAngle(obj, angle+angleadd);
	i++;if(i >= 20){i = 15;}}	
	while( !Obj_BeDeleted(obj) ){yield;}
	}

	function AllLoopShot(angleadd,level){
	let way		= [18,27,36,48];
	let speed	= 2;
	let speedadd	= [0.3,0.2,0.2,0.12];
	let bullet	= RED04;
	let angle 	= 90;

	loop(level * 2 + 3){
	ascent(let i in 0..way[level]){
	LoopShot(GetX,GetY,speed,angle+(360/way[level]*i),angleadd,bullet,20);
	angle += angleadd;
	}
	speed += speedadd[level];
	}
	}

	let angle = 90;
	loop{
	Wait(80);
	loop(7 * level + 5){
	Allshot(2,angle,level * 10 + 15,BLUE04,0);
	angle += 7-level;
	Wait(24);
	}
	Wait(60);
	AllLoopShot(3,level);
	Wait(60);
	AllLoopShot(-3,level);
	Wait(80);
	loop(7 *level + 5){
	Allshot(2,angle,level * 10 + 15,BLUE04,0);
	angle -= 7-level;
	Wait(24);
	}
	Wait(60);
	AllLoopShot(-4,level);
	Wait(60);
	AllLoopShot(4,level);
	}
	}
}