#東方弾幕風
#Title[No.065　死蝶「バタフライループ　-Easy-」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

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

	let name    = "死蝶「バタフライループ　-Easy-」";

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

	@Initialize{
	SetCommonData("ON_SPELL",1);
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 64);
	SetLife(2250);
	SetTimer(59);
	SetScore(5000000 + spellbonus * 2);
	SetDamageRate(50,10);
	SetInvincibility(120);

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

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

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

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

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

	function JikiBatafry(level){
	let speed = 1.5;
	loop(3){
	CreateShotA(1,GetX,GetY,10);
	SetShotDataA(1,0,2,0,0,0,0,RED22);
	CreateShotA(2,GetX,GetY,10);
	SetShotDataA(2,0,2,180,0,0,0,GREEN22);
	SetShotDirectionType(PLAYER);
	SetShotDataA(1,40,speed,0,0,0,0,RED22);
	SetShotDataA(2,80,speed,0,0,0,0,GREEN22);
	SetShotDirectionType(ABSOLUTE);
	FireShot(1);
	FireShot(2);
	speed -= 0.3;
	}
	}

	let angle = 0;
	let mx =GetClipMinX();
	let Mx =GetClipMaxX();
	let angleA = -180;
	let angleB = 0;

	loop{
	loop(10){
	Wait(18 - level * 2);
	CreateShot01(GetX,GetY,2,angleA,PURPLE22,10);
	CreateShot01(GetX,GetY,1.7,angleA+3,PURPLE22,10);
	CreateShot01(GetX,GetY,2,angleB,BLUE22,10);
	CreateShot01(GetX,GetY,1.7,angleB-3,BLUE22,10);
	CreateShot01(GetX,GetY,2,angleA+180,PURPLE22,10);
	CreateShot01(GetX,GetY,1.7,angleA+183,PURPLE22,10);
	CreateShot01(GetX,GetY,2,angleB+180,BLUE22,10);
	CreateShot01(GetX,GetY,1.7,angleB+177,BLUE22,10);
	if(level >= 2){
	CreateShot01(GetX,GetY,2,angleA+90,PURPLE22,10);
	CreateShot01(GetX,GetY,1.7,angleA+93,PURPLE22,10);
	CreateShot01(GetX,GetY,2,angleB+90,BLUE22,10);
	CreateShot01(GetX,GetY,1.7,angleB+87,BLUE22,10);
	CreateShot01(GetX,GetY,2,angleA+270,PURPLE22,10);
	CreateShot01(GetX,GetY,1.7,angleA+273,PURPLE22,10);
	CreateShot01(GetX,GetY,2,angleB+270,BLUE22,10);
	CreateShot01(GetX,GetY,1.7,angleB+267,BLUE22,10);
	}
	if(level == 3){
	CreateShot01(GetX,GetY,2,angleA+45,PURPLE22,10);
	CreateShot01(GetX,GetY,1.7,angleA+48,PURPLE22,10);
	CreateShot01(GetX,GetY,2,angleB+45,BLUE22,10);
	CreateShot01(GetX,GetY,1.7,angleB+42,BLUE22,10);
	CreateShot01(GetX,GetY,2,angleA+135,PURPLE22,10);
	CreateShot01(GetX,GetY,1.7,angleA+138,PURPLE22,10);
	CreateShot01(GetX,GetY,2,angleB+135,BLUE22,10);
	CreateShot01(GetX,GetY,1.7,angleB+132,BLUE22,10);
	CreateShot01(GetX,GetY,2,angleA+225,PURPLE22,10);
	CreateShot01(GetX,GetY,1.7,angleA+228,PURPLE22,10);
	CreateShot01(GetX,GetY,2,angleB+225,BLUE22,10);
	CreateShot01(GetX,GetY,1.7,angleB+222,BLUE22,10);
	CreateShot01(GetX,GetY,2,angleA+315,PURPLE22,10);
	CreateShot01(GetX,GetY,1.7,angleA+318,PURPLE22,10);
	CreateShot01(GetX,GetY,2,angleB+315,BLUE22,10);
	CreateShot01(GetX,GetY,1.7,angleB+312,BLUE22,10);
	}
	angleA += 31.7 / (level + 1);
	angleB += 31.7 / (level + 1);
	}
	JikiBatafry(level);
	}
	}
}