#東方弾幕風
#Title[No.047　想起「ミラクルフルーツ　-Normal-」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{

#include_function ".\弾幕集.txt"
	let name    = "想起「ミラクルフルーツ　-Normal-」";
	let frame   = 0;

	//初期位置
	let xini    =GetCenterX;
	let yini    =GetClipMinY + 120;

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

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

	Shot(1);
	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 FruitShot(n,angle,level){
	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetX(obj, GetX);
	Obj_SetY(obj, GetY);
	Obj_SetSpeed(obj, 2);
	Obj_SetAngle(obj, angle);
	ObjShot_SetGraphic(obj, RED02);
	ObjShot_SetDelay(obj, 15);
	
	loop(60){yield;}
	let a = 0;
	let way = 36;
	if(!Obj_BeDeleted(obj) == true){
	loop(6){
	ascent(let i in 0..way){
	CreateShot02(Obj_GetX(obj) + a * cos(n+(360/way*i)),Obj_GetY(obj) + a * sin(n+(360/way*i)),2,n+(360/way*i),0.001,2.5,RED12,15);
	}
	a += 8;
	}
	}
	Obj_Delete(obj);
	}


	task Shot(level){
	let angle = 70;
	let Angle = 0;
	loop(90){yield;}
	loop{
	loop(6 + level * 2){
	FruitShot(Angle,angle,level);
	angle += 360 / (6 + level * 2);
	Angle += 6.39;
	}
	loop(120){yield;}
	angle += 30;
	}
	}
}