#東方弾幕風
#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,63,63);
	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 a;
	let y = GetClipMinY;
	let angle = 90;
	loop(100){yield;}
	loop{
	x3 = rand(x1+10,x2-100);
	x4 = x3 + 120;
	x = x1;
	while(x < x3){
	CreateShot01(x,y,2,angle,BLUE31,0);
	x += 8;
	}
	x = x4;
	a = 1;
	while(x < x2){
	CreateShot01(x,y,2,angle,BLUE31,0);
	x += 8;
	if(a == 40){break;}
	a++;
	}
	loop(300){yield;}
	}
	}

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

	task GateC(){
	let y;
	let y1 = GetClipMinY;
	let y2 = GetClipMaxY;
	let y3;
	let y4;
	let x = GetClipMinX;
	let angle = 0;
	loop(175){yield;}
	loop{
	y3 = rand(y1+10,y2-100);
	y4 = y3 + 120;
	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;}
	}
	}

	task GateD(){
	let y;
	let y1 = GetClipMinY;
	let y2 = GetClipMaxY;
	let y3;
	let y4;
	let x = GetClipMaxX;
	let angle = 180;
	loop(325){yield;}
	loop{
	y3 = rand(y1+10,y2-100);
	y4 = y3 + 120;
	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;}
	}
	}

	task Shot(){
	GateA();
	GateB();
	GateC();
	GateD();
	loop{
	yield;
	}
	}
}