#東方弾幕風
#Title[No.011　虹符「レインボードールズ　-Normal-」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

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

	let name    = "虹符「レインボードールズ　-Normal-」";

	//初期位置
	let xini    =GetCenterX;
	let yini    =GetCenterY;

	@Initialize{
	SetCommonData("ON_SPELL",1);
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(1750);
	SetTimer(49);
	SetScore(2000000 + spellbonus);
	SetDamageRate(50,10);
	SetInvincibility(120);

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

	@MainLoop{
	ChackBonus;
	SetCollisionA(GetX,GetY,24);
	SetCollisionB(GetX,GetY,24);
	SetCommonData("ALICE_X",GetX);
	SetCommonData("ALICE_Y",GetY);
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	SetCommonData("ON_SPELL",0);
	DeleteGraphic(imgboss2);
	MasicPointAddSpellCard;
	loop(18 + scorebonus){
	let x = rand(GetX-32,GetX+32);
	let y = rand(GetY-32,GetY+32);
	CreateItem(ITEM_SCORE,x,y);}
	}

	task Move(){
	loop{
	yield;
	}
	}

	task Shot(){
	function Wait(time){loop(time){yield;}}
	Wait(60);
	let x = GetCommonData("ALICE_X");
	let y = GetCommonData("ALICE_Y");
	CreateEnemyFromScript("DOLL1",x+180,y,0,90,0);
	CreateEnemyFromScript("DOLL1",x+120,y-20,0,90,1);
	CreateEnemyFromScript("DOLL1",x+60,y-60,0,90,2);
	CreateEnemyFromScript("DOLL1",x,y-100,0,90,3);
	CreateEnemyFromScript("DOLL1",x-60,y-60,0,90,4);
	CreateEnemyFromScript("DOLL1",x-120,y-20,0,90,5);
	CreateEnemyFromScript("DOLL1",x-180,y,0,90,6);
	loop{
	yield;
	}
	}
}

script_enemy DOLL1
{
#include_function ".\弾幕集.txt"

	@Initialize{
	SetX(GetX+64*cos(GetAngle));
	SetY(GetY+64*sin(GetAngle));
	SetLife(1000);
	SetScore(1000);
	SetDamageRate(0,0);

	SetTexture(imgboss2);
	SetGraphicRect(766,0,798,32);
	Shot(0);
	Move();
	}

	@MainLoop{
	ChackBonus;

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	}

	task Move(){
	loop{
	yield;
	}
	}

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

	task ShotA(level){
	let angle	= 90;
	let speed	= [1,1.4,1.8,2.2];
	let wait	= [50,40,40,30];
	let bullet	= [RED04,ORANGE04,YELLOW04,GREEN04,AQUA04,BLUE04,PURPLE04,WHITE04];
	let a		= GetArgument;
	let angleA	= angle;
	let angleB	= angle + 60;
	let angleC	= angle - 60;
	let angleD	= angle;
	let angleE	= angle + 180;

	loop{
	CreateShot01(GetX,GetY,speed[level],angleA,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],angleB,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],angleC,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],angleD,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],angleE,bullet[a],20);
	if(level >= 2){
	CreateShot01(GetX,GetY,speed[level],90+angleA,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],90+angleB,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],90+angleC,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],90+angleD,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],-90+angleA,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],-90+angleB,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],-90+angleC,bullet[a],20);
	CreateShot01(GetX,GetY,speed[level],-90+angleD,bullet[a],20);
	}
	loop(wait[level]){yield;}
	angleA += 6;
	angleB += 4;
	angleC -= 4;
	angleD -= 6;
	angleE += 7;
	}
	}

	Wait(45);
	ShotA(level);
	loop{
	yield;
	}
	}
}