#東方弾幕風
#Title[禁魔「心壊しの扉」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\フランドール.txt"


	let name    = "禁魔「心壊しの扉」";

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

	@Initialize{
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(xini);
	SetY(yini);
	SetLife(1);
	SetTimer(69);
	SetScore(500000);
	SetDamageRate(0,0);
	SetDurableSpellCard();

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

	@MainLoop{
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss);
	CreateItem(ITEM_BOMB,GetX,GetY);
	}


	task GateA(){
	let x;
	let x1 = GetClipMinX;
	let x2 = GetClipMaxX;
	let x3;
	let x4;
	let y = GetClipMinY;
	let angle = 90;
	loop(100){yield;}
	x3 = 179;
	loop{
	x4 = x3 + 90;
	x = x1;
	while(x < x3){
	CreateShot01(x,y,2,angle,BLUE31,0);
	x += 8;
	}
	x = x4;
	while(x < x2){
	CreateShot01(x,y,2,angle,BLUE31,0);
	x += 8;
	}
	loop(300){yield;}
	x3 -= 10;
	}
	}

	task GateB(){
	let x;
	let x1 = GetClipMinX;
	let x2 = GetClipMaxX;
	let x3;
	let x4;
	let y = GetClipMaxY;
	let angle = -90;
	loop(250){yield;}
	x3 = GetClipMaxX - 100;
	loop{
	x4 = x3 + 90;
	x = x1;
	while(x < x3){
	CreateShot01(x,y,2,angle,BLUE31,0);
	x += 8;
	}
	x = x4;
	while(x < x2){
	CreateShot01(x,y,2,angle,BLUE31,0);
	x += 8;
	}
	loop(300){yield;}
	x3 -= 10;
	}
	}

	task GateC(){
	let y;
	let y1 = GetClipMinY;
	let y2 = GetClipMaxY;
	let y3;
	let y4;
	let x = GetClipMinX;
	let angle = 0;
	loop(175){yield;}
	y3 = 280;
	loop{
	y4 = y3 + 90;
	y = y1;
	while(y < y3){
	CreateShot01(x,y,2,angle,BLUE31,0);
	y += 8;
	}
	y = y4;
	while(y < y2){
	CreateShot01(x,y,2,angle,BLUE31,0);
	y += 8;
	}
	loop(300){yield;}
	y3 -= 6.357;
	}
	}

	task GateD(){
	let y;
	let y1 = GetClipMinY;
	let y2 = GetClipMaxY;
	let y3;
	let y4;
	let x = GetClipMaxX;
	let angle = 180;
	loop(325){yield;}
	y3 = GetClipMinY + 104;
	loop{
	y4 = y3 + 90;
	y = y1;
	while(y < y3){
	CreateShot01(x,y,2,angle,BLUE31,0);
	y += 8;
	}
	y = y4;
	while(y < y2){
	CreateShot01(x,y,2,angle,BLUE31,0);
	y += 8;
	}
	loop(300){yield;}
	y3 += 12;
	}
	}

	task Shot(){
	let angle = 0;
	let angleA = 0;
	GateA();
	GateB();
	GateC();
	GateD();
	loop(200){yield;}
	loop{
	Allshot(0.3,angle,16,RED21,0);
	loop(30){
	loop(20){yield;}
	CreateShot01(GetX+120,GetClipMinY,1,angleA,GREEN04,0);
	CreateShot01(GetX-120,GetClipMaxY,1,180+angleA,GREEN04,0);
	CreateShot01(GetClipMinX,GetY+120,1,-90+angleA,GREEN04,0);
	CreateShot01(GetClipMaxX,GetY-120,1,90+angleA,GREEN04,0);
	angleA+= 18;
	}
	angleA = 0;
	angle += 5;
	}
	}
}