#東方弾幕風
#Title[No.039　「キャッツウォーク改　-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(GetClipMinX - 32);
	SetY(GetClipMinY - 32);
	SetLife(3500);
	SetTimer(49);
	SetScore(450000 + spellbonus);
	SetDamageRate(100,7);
	SetInvincibility(180);

	LoadGraphic(imgboss41);
	SetTexture(imgboss41);
	SetGraphicRect(256,0,320,64);
	Move(1);
	}

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

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

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

	task Move(level){
	function Wait(time){loop(time){yield;}}
	let y1 = 120;
	let y2 = 160;
	let y3 = 200;
	let y4 = 240;
	let y5 = 280;
	let y6 = 320;
	let y7 = 360;
	let x1 = GetCenterX - 120;
	let x2 = GetCenterX + 120;

	SetMovePosition02(GetCenterX,y1,20);
	Wait(60);
	loop{
	Shot(430,level);
	SetMovePosition02(x2,y2,20);
	Wait(90);
	Shot(350,level);
	SetGraphicRect(192,0,256,64);
	SetMovePosition02(GetCenterX,y3,20);
	Wait(90);
	Shot(270,level);
	SetMovePosition02(x1,y4,20);
	Wait(90);
	Shot(190,level);
	SetGraphicRect(256,0,320,64);
	SetMovePosition02(GetCenterX,y5,20);
	Wait(90);
	Shot(110,level);
	SetMovePosition02(x2,y6,20);
	Wait(90);
	Shot(30,level);
	SetMovePosition02(GetClipMaxX+32,y7,20);
	Wait(20);
	SetY(GetClipMinY - 32);
	SetGraphicRect(192,0,256,64);
	SetMovePosition02(GetCenterX,y1,20);
	Wait(120);
	Shot(430,level);
	SetMovePosition02(x1,y2,20);
	Wait(90);
	Shot(350,level);
	SetGraphicRect(256,0,320,64);
	SetMovePosition02(GetCenterX,y3,20);
	Wait(90);
	Shot(270,level);
	SetMovePosition02(x2,y4,20);
	Wait(90);
	Shot(190,level);
	SetGraphicRect(192,0,256,64);
	SetMovePosition02(GetCenterX,y5,20);
	Wait(90);
	Shot(110,level);
	SetMovePosition02(x1,y6,20);
	Wait(90);
	Shot(30,level);
	SetMovePosition02(GetClipMinX+32,y7,20);
	Wait(20);
	SetY(GetClipMinY - 32);
	SetGraphicRect(256,0,320,64);
	SetMovePosition02(GetCenterX,y1,20);
	Wait(120);
	}
	}

	function Shot(wait,level){
	AroundToShot(GetX,GetY,32,level * 6 + 12,wait,2,90,0,false,false,BLUE21,20);
	if(level >= 1){AroundToShot(GetX,GetY,64,level * 6 + 12,wait-10,2,83,0,false,false,BLUE21,20);}
	if(level >= 2){AroundToShot(GetX,GetY,96,level * 6 + 12,wait-20,2,76,0,false,false,BLUE21,20);}
	if(level == 3){AroundToShot(GetX,GetY,128,level * 6 + 12,wait-10,2,69,0,false,false,BLUE21,20);}
	}
}