#東方弾幕風
#Title[No.049　想起「波と粒の境界　-Lunatic-」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{

#include_function ".\弾幕集.txt"
	let name    = "想起「波と粒の境界　-Lunatic-」";
	let frame   = 0;

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

	@Initialize{
	SetCommonData("ON_SPELL",1);
	CutIn(YOUMU,name,"",0,0,0,0);
	SetLife(2250);
	SetTimer(49);
	SetScore(550000 + spellbonus);
	SetDamageRate(50,7);

	LoadGraphic(imgboss42);
	SetTexture(imgboss42);
	SetGraphicRect(0,0,63,63);

	Shot(3);
	yield;
	SetMovePosition03(xini,yini,5,10);
	}

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

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

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


	task Shot(level){
	let angle = 90;
	let Angle = -30;
	loop(90){yield;}
	loop{
	CreateShot01(GetX + 48 * cos(angle),GetY + 48 * sin(angle),2.5,angle,PURPLE23,30);
	if(level == 0){
	CreateShot01(GetX + 48 * cos(angle+120),GetY + 48 * sin(angle+120),2,angle+120,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle-120),GetY + 48 * sin(angle-120),2,angle-120,PURPLE23,30);
	}
	if(level == 1){
	CreateShot01(GetX + 48 * cos(angle+90),GetY + 48 * sin(angle+90),2,angle+90,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle-90),GetY + 48 * sin(angle-90),2,angle-90,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle+180),GetY + 48 * sin(angle+180),2,angle+180,PURPLE23,30);
	}
	if(level == 2){
	CreateShot01(GetX + 48 * cos(angle+72),GetY + 48 * sin(angle+72),2,angle+72,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle-72),GetY + 48 * sin(angle-72),2,angle-72,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle+144),GetY + 48 * sin(angle+144),2,angle+144,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle-144),GetY + 48 * sin(angle-144),2,angle-144,PURPLE23,30);
	}
	if(level == 3){
	CreateShot01(GetX + 48 * cos(angle+180),GetY + 48 * sin(angle+180),2.5,angle+180,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle+60),GetY + 48 * sin(angle+60),2.5,angle+60,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle-60),GetY + 48 * sin(angle-60),2.5,angle-60,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle+120),GetY + 48 * sin(angle+120),2.5,angle+120,PURPLE23,30);
	CreateShot01(GetX + 48 * cos(angle-120),GetY + 48 * sin(angle-120),2.5,angle-120,PURPLE23,30);
	}
	angle += 20 * sin(Angle);
	Angle += 1.29;
	yield;
	}
	}
}