task ShouLaserA2(id, angle, delay, color, blend, killtime){
let c=[0, 0, 0];
let x=ObjRender_GetX(id); let y=ObjRender_GetY(id);
let graphic=ST_LASER_RED;
let w=4;
alternative (color)
case ("red"){c=[255, 0, 0]; graphic=ST_LASER_RED;}
case ("orange"){c=[255, 155, 55]; graphic=ST_LASER_ORANGE;}
case ("yellow"){c=[255, 255, 0]; graphic=ST_LASER_YELLOW;}
case ("green"){c=[0, 255, 0]; graphic=ST_LASER_GREEN;}
case ("aqua"){c=[0, 0, 255]; graphic=ST_LASER_AQUA;}
case ("blue"){c=[0, 255, 255]; graphic=ST_LASER_BLUE;}
case ("purple"){c=[255, 0, 255]; graphic=ST_LASER_PURPLE;}

LBeam;
LSource(BLEND_ALPHA, [255, 255, 255]);
LSource(blend, c);
while(!Obj_IsDeleted(id)){x=ObjRender_GetX(id); y=ObjRender_GetY(id); yield;}

	task LMove(c, blend, alpha){
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetPosition(obj, x+500*cos(angle), y+500*sin(angle), 0);
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"/img/stage05e02.png");
	ObjRender_SetBlendType(obj, blend);
	ObjRender_SetAlpha(obj, alpha);
	ObjRender_SetColor(obj, c[0], c[1], c[2]);
	let s=0;
	ObjRender_SetAngleXYZ(obj, 0, 0, angle);
	Obj_SetRenderPriorityI(obj, 50);
	loop(killtime){
	ObjRender_SetPosition(obj, x+500*cos(angle), y+500*sin(angle), 0);
	ObjRender_SetScaleXYZ(obj, 1, w/30, 0);
	s-=15; ObjSprite2D_SetSourceRect(obj, s, 0, s+1000, 32);
	ObjSprite2D_SetDestCenter(obj);
	yield;}
	Obj_Delete(obj);
	}

	task LBeam{
	let obj=ObjShot_Create(OBJ_STRAIGHT_LASER);
	ObjShot_SetGraphic(obj, graphic);
	ObjMove_SetPosition(obj, x, y);
	ObjStLaser_SetAngle(obj, angle);
	ObjShot_Regist(obj);
	ObjLaser_SetLength(obj, 1000);
	ObjShot_SetIntersectionEnable(obj, false);
	
	let o=ObjShot_Create(OBJ_STRAIGHT_LASER);
	ObjMove_SetPosition(o, x, y);
	ObjStLaser_SetAngle(o, angle);
	ObjShot_Regist(o);
	ObjShot_SetGraphic(o, LIGHTNING);
	ObjLaser_SetLength(o, 1000);
	ObjShot_SetIntersectionEnable(o, false);
	Obj_SetRenderPriority(o, 0.51);
	ObjRender_SetAlpha(o, 155);
	loop(delay){
	ObjMove_SetPosition(obj, x, y);
	ObjLaser_SetRenderWidth(obj, w); ObjLaser_SetIntersectionWidth(obj, w/2);
	yield;}
PlaySoundEffect("se_lazer00");
	loop(60){
	ObjMove_SetPosition(obj, x, y);
	ObjMove_SetPosition(o, x, y);
	w+=28/60; ObjLaser_SetRenderWidth(obj, w); ObjLaser_SetIntersectionWidth(obj, w/2);
	ObjLaser_SetRenderWidth(o, w*1.2);
	if (w>12){ObjShot_SetIntersectionEnable(obj, true);}
	yield;}
	loop(killtime-120-delay){
	ObjMove_SetPosition(o, x, y);
	ObjMove_SetPosition(obj, x, y);
	yield;}
	loop(60){ObjMove_SetPosition(obj, x, y);
	ObjMove_SetPosition(o, x, y);
	ObjLaser_SetRenderWidth(o, w*1.2);
	w-=28/60; ObjLaser_SetRenderWidth(obj, w); ObjLaser_SetIntersectionWidth(obj, w/2);
	if (w<12){ObjShot_SetIntersectionEnable(obj, false);}
	yield;}
	Obj_Delete(obj);
	Obj_Delete(o);
	}

	task LSource(b, colors){
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetPosition(obj, x+64*cos(angle), y+64*sin(angle), 0);
	ObjRender_SetBlendType(obj, b);
	Obj_SetRenderPriorityI(obj, 50);
	ObjRender_SetAngleXYZ(obj, 0, 0, angle);
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"/img/stage05e02.png");
	ObjRender_SetColor(obj, colors[0], colors[1], colors[2]);
	let s=1; let size=1; let k=0;
	loop(killtime-60){
	ObjRender_SetPosition(obj, x+64*cos(angle), y+64*sin(angle), 0);
	k++; if (k%2==0){s*=-1;}
	if (s>0){ObjSprite2D_SetSourceRect(obj, 128, 128, 253, 256);}
	if (s<0){ObjSprite2D_SetSourceRect(obj, 0, 128, 125, 256);}
	ObjSprite2D_SetDestCenter(obj);
	yield;}
	loop(60){k++; if (k%2==0){s*=-1;}
	ObjRender_SetPosition(obj, x+64*cos(angle), y+64*sin(angle), 0);
	if (s>0){ObjSprite2D_SetSourceRect(obj, 128, 128, 253, 256);}
	if (s<0){ObjSprite2D_SetSourceRect(obj, 0, 128, 125, 256);}
	ObjSprite2D_SetDestCenter(obj);
	size-=1/60;
	ObjRender_SetScaleXYZ(obj, 1, size, 0);
	yield;}
	Obj_Delete(obj);
	}
}

task ShouLaserA1(x, y, angle, delay, color, blend, killtime){
let c=[0, 0, 0];
let graphic=ST_LASER_RED;
let w=4;
alternative (color)
case ("red"){c=[255, 0, 0]; graphic=ST_LASER_RED;}
case ("orange"){c=[255, 155, 55]; graphic=ST_LASER_ORANGE;}
case ("yellow"){c=[255, 255, 0]; graphic=ST_LASER_YELLOW;}
case ("green"){c=[0, 255, 0]; graphic=ST_LASER_GREEN;}
case ("aqua"){c=[0, 0, 255]; graphic=ST_LASER_AQUA;}
case ("blue"){c=[0, 255, 255]; graphic=ST_LASER_BLUE;}
case ("purple"){c=[255, 0, 255]; graphic=ST_LASER_PURPLE;}

LBeam;
LMove;
LSource(BLEND_ALPHA, [255, 255, 255]);
LSource(blend, c);


	task LMove{
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetPosition(obj, x+500*cos(angle), y+500*sin(angle), 0);
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"/img/stage05e02.png");
	ObjRender_SetBlendType(obj, BLEND_ALPHA);
	ObjRender_SetAlpha(obj, 155);
	let s=0;
	ObjRender_SetAngleXYZ(obj, 0, 0, angle);
	loop(killtime){
	ObjRender_SetScaleXYZ(obj, 1, w/32, 0);
	s-=15; ObjSprite2D_SetSourceRect(obj, s, 0, s+1000, 32);
	ObjSprite2D_SetDestCenter(obj);
	yield;}
	Obj_Delete(obj);
	}

	task LBeam{
	let obj=ObjShot_Create(OBJ_STRAIGHT_LASER);
	ObjShot_SetGraphic(obj, graphic);
	ObjMove_SetPosition(obj, x, y);
	ObjStLaser_SetAngle(obj, angle);
	ObjShot_Regist(obj);
	ObjLaser_SetLength(obj, 1000);
	ObjShot_SetIntersectionEnable(obj, false);
	loop(delay){
	ObjLaser_SetRenderWidth(obj, w); ObjLaser_SetIntersectionWidth(obj, w/2);
	yield;}
PlaySoundEffect("se_lazer00");
	loop(60){
	w+=28/60; ObjLaser_SetRenderWidth(obj, w); ObjLaser_SetIntersectionWidth(obj, w/2);
	if (w>12){ObjShot_SetIntersectionEnable(obj, true);}
	yield;}
	loop(killtime-120-delay){yield;}
	loop(60){
	w-=28/60; ObjLaser_SetRenderWidth(obj, w); ObjLaser_SetIntersectionWidth(obj, w/2);
	if (w<12){ObjShot_SetIntersectionEnable(obj, false);}
	yield;}
	Obj_Delete(obj);
	}

	task LSource(b, colors){
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetPosition(obj, x+64*cos(angle), y+64*sin(angle), 0);
	ObjRender_SetBlendType(obj, b);
	ObjRender_SetAngleXYZ(obj, 0, 0, angle);
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"/img/stage05e02.png");
	ObjRender_SetColor(obj, colors[0], colors[1], colors[2]);
	let s=1; let size=1; let k=0;
	loop(killtime-60){
	k++; if (k%2==0){s*=-1;}
	if (s>0){ObjSprite2D_SetSourceRect(obj, 128, 128, 253, 256);}
	if (s<0){ObjSprite2D_SetSourceRect(obj, 0, 128, 125, 256);}
	ObjSprite2D_SetDestCenter(obj);
	yield;}
	loop(60){k++; if (k%2==0){s*=-1;}
	if (s>0){ObjSprite2D_SetSourceRect(obj, 128, 128, 253, 256);}
	if (s<0){ObjSprite2D_SetSourceRect(obj, 0, 128, 125, 256);}
	ObjSprite2D_SetDestCenter(obj);
	size-=1/60;
	ObjRender_SetScaleXYZ(obj, 1, size, 0);
	yield;}
	Obj_Delete(obj);
	}
}


task NuclearBombA1(x, y, speed, angle, acceleration, maxspeed, size, color){

let rcolor=[0, 0, 0]; let rcolor2=[0, 0, 0];
alternative (color)
case("red"){rcolor=[255, 155, 155]; rcolor2=[255, 100, 100];}
case("orange"){rcolor=[255, 155, 125]; rcolor2=[255, 155, 100];}
case("yellow"){rcolor=[255, 255, 55]; rcolor2=[255, 255, 100];}
case("green"){rcolor=[155, 255, 155]; rcolor2=[100, 255, 100];}
case("aqua"){rcolor=[155, 255, 255]; rcolor2=[100, 255, 255];}
case("blue"){rcolor=[155, 155, 255]; rcolor2=[100, 100, 255];}
case("purple"){rcolor=[255, 155, 255]; rcolor2=[255, 100, 255];}

	let s=0; let t=0;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	let obj2=ObjShot_Create(OBJ_STRAIGHT_LASER); ObjShot_Regist(obj2);
	ObjRender_SetPosition(obj, x, y, 0);
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"/img/nuclear1.png");
	ObjSprite2D_SetSourceRect(obj, 0, 0, 256, 256);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj, BLEND_ADD_ARGB);
	ObjRender_SetColor(obj, rcolor[0], rcolor[1], rcolor[2]);
	
	
	let obj3=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetPosition(obj3, x, y, 0);
	ObjPrim_SetTexture(obj3, GetCurrentScriptDirectory~"/img/nuclear2.png");
	ObjSprite2D_SetSourceRect(obj3, 0, 0, 256, 256);
	ObjSprite2D_SetDestCenter(obj3);
	ObjRender_SetBlendType(obj3, BLEND_ADD_ARGB);
	ObjRender_SetColor(obj3, rcolor2[0], rcolor2[1], rcolor2[2]);
	
	Obj_SetRenderPriorityI(obj, 50);
	Obj_SetRenderPriorityI(obj3, 49);
	
	let alpha=0;
	loop(15){
	s+=size/15; 
	alpha+=255/15;
	ObjRender_SetScaleXYZ(obj, s, s, 0);
	ObjRender_SetAlpha(obj, alpha);
	ObjRender_SetScaleXYZ(obj3, s*1.25, s*1.25, 0);
	ObjRender_SetAlpha(obj3, alpha/2);
	yield;
	}
	while(!Obj_IsDeleted(obj)){
	ObjMove_SetPosition(obj2, x, y);
	ObjShot_SetIntersectionCircleA1(obj2, s*72);
	t+=10;
	ObjRender_SetScaleXYZ(obj, s+0.01*sin(t), s+0.01*sin(t), 0);
	ObjRender_SetAngleXYZ(obj, 0, 0, rand(0,360));
	ObjRender_SetPosition(obj, x, y, 0);
	
	ObjRender_SetScaleXYZ(obj3, s*1.25+0.0125*sin(t), s*1.25+0.0125*sin(t), 0);
	ObjRender_SetPosition(obj3, x, y, 0);
	
	speed+=acceleration; if (speed>maxspeed){speed=maxspeed;}
	x+=speed*cos(angle); y+=speed*sin(angle);
	yield;}
}


task NuclearBombA2(x, y, s, delay, kill, color){

let rcolor=[0, 0, 0]; let rcolor2=[0, 0, 0];
alternative (color)
case("red"){rcolor=[255, 155, 155]; rcolor2=[255, 100, 100];}
case("orange"){rcolor=[255, 155, 125]; rcolor2=[255, 155, 100];}
case("yellow"){rcolor=[255, 255, 55]; rcolor2=[255, 255, 100];}
case("green"){rcolor=[155, 255, 155]; rcolor2=[100, 255, 100];}
case("aqua"){rcolor=[155, 255, 255]; rcolor2=[100, 255, 255];}
case("blue"){rcolor=[155, 155, 255]; rcolor2=[100, 100, 255];}
case("purple"){rcolor=[255, 155, 255]; rcolor2=[255, 100, 255];}

	let t=0;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	let obj2=ObjShot_Create(OBJ_STRAIGHT_LASER); ObjShot_Regist(obj2);
	ObjRender_SetPosition(obj, x, y, 0);
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"/img/nuclear1.png");
	ObjSprite2D_SetSourceRect(obj, 0, 0, 256, 256);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj, BLEND_ADD_ARGB);
	ObjRender_SetColor(obj, rcolor[0], rcolor[1], rcolor[2]);
	
	
	let obj3=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetPosition(obj3, x, y, 0);
	ObjPrim_SetTexture(obj3, GetCurrentScriptDirectory~"/img/nuclear2.png");
	ObjSprite2D_SetSourceRect(obj3, 0, 0, 256, 256);
	ObjSprite2D_SetDestCenter(obj3);
	ObjRender_SetBlendType(obj3, BLEND_ADD_ARGB);
	ObjRender_SetColor(obj3, rcolor2[0], rcolor2[1], rcolor2[2]);
	
	Obj_SetRenderPriorityI(obj, 50);
	Obj_SetRenderPriorityI(obj3, 49);
	
	let alpha=0;
	loop(delay){
	alpha+=255/delay;
	ObjRender_SetScaleXYZ(obj, s, s, 0);
	ObjRender_SetAlpha(obj, alpha);
	ObjRender_SetScaleXYZ(obj3, s*1.25, s*1.25, 0);
	ObjRender_SetAlpha(obj3, alpha/2);
	yield;
	}
	loop(kill){
	ObjMove_SetPosition(obj2, x, y);
	ObjShot_SetIntersectionCircleA1(obj2, s*80);
	t+=10;
	ObjRender_SetAngleXYZ(obj, 0, 0, rand(0,360));
	
	ObjRender_SetScaleXYZ(obj3, s*1.25+0.0125*sin(t), s*1.25+0.0125*sin(t), 0);
	
	yield;}
	Obj_Delete(obj2);
	loop(30){
	t+=10;
	ObjRender_SetAngleXYZ(obj, 0, 0, rand(0,360));
	
	ObjRender_SetScaleXYZ(obj3, s*1.25+0.0125*sin(t), s*1.25+0.0125*sin(t), 0);
	alpha-=255/30;
	ObjRender_SetAlpha(obj, alpha);
	ObjRender_SetAlpha(obj3, alpha/2);
	yield;}
	Obj_Delete(obj); Obj_Delete(obj3);
}

function SetInvincibility(ID, frame){
let array=[ObjEnemy_GetInfo(ID, INFO_DAMAGE_RATE_SHOT), ObjEnemy_GetInfo(ID, INFO_DAMAGE_RATE_SPELL)];
ObjEnemy_SetDamageRate(ID, 0, 0);
loop(frame){yield;}
ObjEnemy_SetDamageRate(ID, array[0], array[1]);
}

function TMovement(x,y,speed){
		let resultx=rand(0,1);
		resultx=round(resultx);
		let resulty=rand(0,1);
		resulty=round(resulty);
		let posx=rand(10,-10);
		if(posx<=10&&posx>=-10){
			if(resultx==1){
				posx=x;
			}else{
				posx=-x;
			}
		}
		if((ObjMove_GetX(enm)+posx)<=160||(ObjMove_GetX(enm)+posx)>=480){
			posx=-posx;
		}
		
		let posy=rand(20,-20);
		if(posy<=7.5&&posy>=-7.5){
			if(resulty==1){
				posy=y;
			}else{
				posy=-y;
			}
		}
		if((ObjMove_GetY(enm)+posy)<=64||(ObjMove_GetY(enm)+posy)>=GetStgFrameHeight()/3){
			posy=-posy;
		}
		ObjMove_SetDestAtWeight(enm,ObjMove_GetX(enm)+posx,ObjMove_GetY(enm)+posy,10,speed);
}

function TMovement2(enm,x,y,speed){
		let resultx=rand(0,1);
		resultx=round(resultx);
		let resulty=rand(0,1);
		resulty=round(resulty);
		let posx=rand(10,-10);
		if(posx<=10&&posx>=-10){
			if(resultx==1){
				posx=x;
			}else{
				posx=-x;
			}
		}
		if((ObjMove_GetX(enm)+posx)<=160||(ObjMove_GetX(enm)+posx)>=480){
			posx=-posx;
		}
		
		let posy=rand(20,-20);
		if(posy<=7.5&&posy>=-7.5){
			if(resulty==1){
				posy=y;
			}else{
				posy=-y;
			}
		}
		if((ObjMove_GetY(enm)+posy)<=64||(ObjMove_GetY(enm)+posy)>=GetStgFrameHeight()/3){
			posy=-posy;
		}
		ObjMove_SetDestAtWeight(enm,ObjMove_GetX(enm)+posx,ObjMove_GetY(enm)+posy,10,speed);
}


task JudgementLaser(x, y, angle, width, length, lengthen, graphic){
let obj=ObjShot_Create(OBJ_STRAIGHT_LASER); 
ObjShot_Regist(obj);
ObjShot_SetGraphic(obj, graphic);
ObjStLaser_SetSource(obj, false);
ObjMove_SetPosition(obj, x, y);
ObjStLaser_SetAngle(obj, angle);
let w=4; let l=0; let t=0;
ObjShot_SetIntersectionEnable(obj, false);
while(!Obj_IsDeleted(obj)){
t++;
if (t<30){l+=length/30;} else{l+=lengthen;}
if (t>=60){if (t<70){w+=width/10; 
if (w>width/2){ObjShot_SetIntersectionEnable(obj, true);}
}
}
if (t>180){ObjShot_SetIntersectionEnable(obj, false);
w-=width/30; if (w<=0){Obj_Delete(obj);}}
ObjLaser_SetRenderWidth(obj, w);
ObjLaser_SetIntersectionWidth(obj, w/5);
ObjLaser_SetLength(obj, l);
yield;}
}


task DelayLaser(x, y, angle, graphic, time){
let obj=ObjShot_Create(OBJ_STRAIGHT_LASER);
let l=0;
ObjLaser_SetRenderWidth(obj, 3);
ObjShot_SetIntersectionEnable(obj, false);
ObjShot_Regist(obj);
ObjMove_SetPosition(obj, x, y);
ObjShot_SetGraphic(obj, graphic);
ObjStLaser_SetAngle(obj, angle);
loop(time){
if (l<600){l+=30;}
ObjLaser_SetLength(obj, l);
yield;}
Obj_Delete(obj);
}


task PlaySoundEffect(sound){
let se=ObjSound_Create;
ObjSound_Load(se, GetCurrentScriptDirectory~"system/se/"~sound~".wav");
ObjSound_SetVolumeRate(se, 40);
ObjSound_Play(se);
}

task TShake(period, intensity)
	{
		loop(period)
		{
			Set2DCameraFocusX(GetStgFrameWidth / 2 + rand(-intensity/2, intensity/2));
			Set2DCameraFocusY(GetStgFrameHeight / 2 + rand(-intensity/2, intensity/2));
			yield;
		}

		Reset2DCamera();
	}
	
	
	task Obj_SpinXYZ(obj, xspin, yspin, zspin, i){
	if(i <= 0){
		while(!Obj_IsDeleted(obj)){
			ObjRender_SetAngleXYZ(obj, ObjRender_GetAngleX(obj) + xspin, ObjRender_GetAngleY(obj) + yspin, ObjRender_GetAngleZ(obj) + zspin);
			yield;
		}
		return;
	}else{
		while(i > 0){
			ObjRender_SetAngleXYZ(obj, ObjRender_GetAngleX(obj) + xspin, ObjRender_GetAngleY(obj) + yspin, ObjRender_GetAngleZ(obj) + zspin);
			i--;
			yield;
		}
		ObjRender_SetAngleXYZ(obj, 0, 0, 0);
		return;
	}
}

task IntroName(name){
	
	DrawBorderBack( 40 );
	
let obj=ObjPrim_Create(OBJ_SPRITE_2D);
//GetCurrentScriptDirectory~"./../img/BossName/RumiaName.png" <<< Directory BossNameImage here
ObjPrim_SetTexture(obj, name);
ObjSprite2D_SetSourceRect(obj, 0, 0, 384, 64);
ObjSprite2D_SetDestCenter(obj);
Obj_SetRenderPriorityI(obj, 60);
ObjRender_SetScaleXYZ(obj,1.25,1.25,0);
ObjRender_SetY(obj, GetCenterY());

let alpha=15; let ang=0; let x=GetScreenWidth/2+150; let v=1.05;
let time = 25;

ascent(i in 0 .. time){
			let rate = 1-sin(90*i/time);
			let x = GetCenterX()+256*rate;
			ObjRender_SetX(obj, x);
			ObjRender_SetScaleXYZ(obj, 1+rate, 1-rate, 0);
			yield;
		}
		ObjRender_SetX(obj, GetCenterX());
		ObjRender_SetScaleXYZ(obj, 1, 1, 0);
		loop(40-time){yield;}
		ascent(i in 1 .. time+1){
			let rate = 1-cos(90*i/time);
			let x = GetCenterX()-rate;
			ObjRender_SetX(obj, x);
			ObjRender_SetScaleXYZ(obj, 1+rate, 1-rate, 0);
			yield;
		}
Obj_Delete(obj);

task DrawBorderBack( m_wait ){
		let gcsd	= GetCurrentScriptDirectory();
		let obj		= [ ObjPrim_Create(OBJ_SPRITE_2D), ObjPrim_Create(OBJ_SPRITE_2D) ];
		let scale	= [ 1, 1 ];
		let move1	= 0;
		let moveA	= 0;
		let frame	= 0;
		
			let pathBorderBack = [ gcsd ~ "/img/none.png", gcsd ~ "/img/cutin1.png" ];
		let blend = [ BLEND_ALPHA, BLEND_ADD_ARGB ];
		let alpha = [ 1024, 80 ];
		ascent( let i in 0..length(obj) ){
			ObjRender_SetPosition( obj[i], 200, 250, 0 );
			ObjPrim_SetTexture( obj[i], pathBorderBack[i] );
			Obj_SetRenderPriority( obj[i], 0.1 );
			ObjRender_SetBlendType( obj[i], blend[i] );
			ObjRender_SetX(obj[i], GetCenterX());
			ObjRender_SetAngleXYZ( obj[i], 0, 0, 0 - i*150 );
			ObjSprite2D_SetSourceRect( obj[i], 0, 0, 1024, 80 );
			ObjSprite2D_SetDestCenter( obj[i] );
			ObjRender_SetAlpha( obj[i], alpha[i] );
		}
		ObjSprite2D_SetSourceRect( obj[1], 0, 0, 1024, 128 );
		ObjSprite2D_SetDestCenter( obj[1] );
		
		while( move1 < 1 ){
			move1 = 1 * sin( moveA );
			moveA += 15;
			ascent( i in 0..length(obj) ){
				ObjRender_SetScaleXYZ( obj[i], scale[i], move1*scale[i], 0 );
			}
			ObjSprite2D_SetSourceRect( obj[1], 0 + frame, 0, 1024 + frame, 128 );
			frame++;
			yield;
		}
		move1 = 0;
		moveA = 0;
		//　m_waitフレーム待機
		loop( m_wait ){
			ObjSprite2D_SetSourceRect( obj[1], 0 + frame, 0, 1024 + frame, 128 );
			frame++;
			yield;
		}
		while( move1 < 1 ){
			move1 = 1 * sin( moveA );
			moveA += 15;
			ascent( i in 0..length(obj) ){
				ObjRender_SetScaleXYZ( obj[i], scale[i], scale[i] - move1*scale[i], 0 );
			}
			ObjSprite2D_SetSourceRect( obj[1], 0 + frame, 0, 1024 + frame, 128 );
			frame++;
			yield;
		}
		ascent( i in 0..length(obj) ){
			Obj_Delete( obj[i] );
		}
	}
}


function GetCenterX(){
	return (GetCommonData("STGFrame_L", 128)+GetCommonData("STGFrame_R", 512))/2;
}

function GetCenterY(){
	return (GetCommonData("STGFrame_U", 16)+GetCommonData("STGFrame_D", 464))/2;
}

function GetClipMinX(){
	return GetCommonData("STGFrame_L", 128);
}

function GetClipMinY(){
	return GetCommonData("STGFrame_U", 16);
}

function GetClipMaxX(){
	return GetCommonData("STGFrame_R", 512);

}

function GetClipMaxY(){
	return GetCommonData("STGFrame_D", 464);
}

task IntroNameDuo1(name){
	
	DrawBorderBack( 40 );
	
let obj=ObjPrim_Create(OBJ_SPRITE_2D);
//GetCurrentScriptDirectory~"./../img/BossName/RumiaName.png" <<< Directory BossNameImage here
ObjPrim_SetTexture(obj, name);
ObjSprite2D_SetSourceRect(obj, 0, 0, 384, 64);
ObjSprite2D_SetDestCenter(obj);
Obj_SetRenderPriorityI(obj, 60);
ObjRender_SetScaleXYZ(obj,1,1.1,0);
ObjRender_SetY(obj, GetCenterY() + 50);


let alpha=15; let ang=0; let x=GetScreenWidth/2+150; let v=1.05;
let time = 25;

ascent(i in 0 .. time){
			let rate = 1-sin(90*i/time);
			let x = GetCenterX()+256*rate;
			ObjRender_SetX(obj, x);
			ObjRender_SetScaleXYZ(obj, 1+rate, 1-rate, 0);
			yield;
		}
		ObjRender_SetX(obj, GetCenterX());
		ObjRender_SetScaleXYZ(obj, 1, 1, 0);
		loop(40-time){yield;}
		ascent(i in 1 .. time+1){
			let rate = 1-cos(90*i/time);
			let x = GetCenterX()-rate;
			ObjRender_SetX(obj, x);
			ObjRender_SetScaleXYZ(obj, 1+rate, 1-rate, 0);
			yield;
		}
Obj_Delete(obj);

task DrawBorderBack( m_wait ){
		let gcsd	= GetCurrentScriptDirectory();
		let obj		= [ ObjPrim_Create(OBJ_SPRITE_2D), ObjPrim_Create(OBJ_SPRITE_2D) ];
		let scale	= [ 1, 1 ];
		let move1	= 0;
		let moveA	= 0;
		let frame	= 0;
		
			let pathBorderBack = [ gcsd ~ "/img/none.png", gcsd ~ "/img/cutin1.png" ];
		let blend = [ BLEND_ALPHA, BLEND_ADD_ARGB ];
		let alpha = [ 1024, 80 ];
		ascent( let i in 0..length(obj) ){
			ObjRender_SetPosition( obj[i], 200, 250, 0 );
			ObjPrim_SetTexture( obj[i], pathBorderBack[i] );
			Obj_SetRenderPriority( obj[i], 0.5 );
			ObjRender_SetBlendType( obj[i], blend[i] );
			ObjRender_SetX(obj[i], GetCenterX());
			ObjRender_SetAngleXYZ( obj[i], 0, 0, 0 - i*150 );
			ObjSprite2D_SetSourceRect( obj[i], 0, 0, 1024, 80 );
			ObjSprite2D_SetDestCenter( obj[i] );
			ObjRender_SetAlpha( obj[i], alpha[i] );
		}
		ObjSprite2D_SetSourceRect( obj[1], 0, 0, 1024, 128 );
		ObjSprite2D_SetDestCenter( obj[1] );
		
		while( move1 < 1 ){
			move1 = 1 * sin( moveA );
			moveA += 15;
			ascent( i in 0..length(obj) ){
				ObjRender_SetScaleXYZ( obj[i], scale[i], move1*scale[i], 0 );
			}
			ObjSprite2D_SetSourceRect( obj[1], 0 + frame, 0, 1024 + frame, 128 );
			frame++;
			yield;
		}
		move1 = 0;
		moveA = 0;
		//　m_waitフレーム待機
		loop( m_wait ){
			ObjSprite2D_SetSourceRect( obj[1], 0 + frame, 0, 1024 + frame, 128 );
			frame++;
			yield;
		}
		while( move1 < 1 ){
			move1 = 1 * sin( moveA );
			moveA += 15;
			ascent( i in 0..length(obj) ){
				ObjRender_SetScaleXYZ( obj[i], scale[i], scale[i] - move1*scale[i], 0 );
			}
			ObjSprite2D_SetSourceRect( obj[1], 0 + frame, 0, 1024 + frame, 128 );
			frame++;
			yield;
		}
		ascent( i in 0..length(obj) ){
			Obj_Delete( obj[i] );
		}
	}
}

	
task IntroNameDuo2(name){
	
	
	
let obj=ObjPrim_Create(OBJ_SPRITE_2D);
//GetCurrentScriptDirectory~"./../img/BossName/RumiaName.png" <<< Directory BossNameImage here
ObjPrim_SetTexture(obj, name);
ObjSprite2D_SetSourceRect(obj, 0, 0, 384, 64);
ObjSprite2D_SetDestCenter(obj);
Obj_SetRenderPriorityI(obj, 60);
ObjRender_SetScaleXYZ(obj,1,1.1,0);
ObjRender_SetY(obj, GetCenterY() - 50);


let alpha=15; let ang=0; let x=GetScreenWidth/2-150; let v=1.05;
let time = 25;

ascent(i in 0 .. time){
			let rate = 1-sin(90*i/time);
			let x = GetCenterX()-256*rate;
			ObjRender_SetX(obj, x);
			ObjRender_SetScaleXYZ(obj, 1+rate, 1-rate, 0);
			yield;
		}
		ObjRender_SetX(obj, GetCenterX());
		ObjRender_SetScaleXYZ(obj, 1, 1, 0);
		loop(40-time){yield;}
		ascent(i in 1 .. time+1){
			let rate = 1-cos(90*i/time);
			let x = GetCenterX()-rate;
			ObjRender_SetX(obj, x);
			ObjRender_SetScaleXYZ(obj, 1+rate, 1-rate, 0);
			yield;
		}
Obj_Delete(obj);


}

task ObjMove_ReflectCeiling(obj, limit){
	let count = 0;
	while(!Obj_IsDeleted(obj)){
		
		if(ObjMove_GetY(obj) <= 0 && ObjMove_GetY(obj) >= -20 && count < limit){
			PlaySoundEffect("se_kira00");
			ObjMove_SetAngle(obj, -ObjMove_GetAngle(obj));
			count++;
		}
		yield;
	}
}
task ObjMove_ReflectBottom(obj, limit){
	let count = 0;
	while(!Obj_IsDeleted(obj)){
			
		if(ObjMove_GetY(obj) >= GetStgFrameHeight && ObjMove_GetY(obj) <= GetStgFrameHeight + 20 && count < limit){
			PlaySoundEffect("se_kira00");
			ObjMove_SetAngle(obj, -ObjMove_GetAngle(obj));
			count++;
		}
		yield;
	}
}
task ObjMove_ReflectWalls(obj, limit){
	let count = 0;
	while(!Obj_IsDeleted(obj)){
	
		if(ObjMove_GetX(obj) <= 0 && ObjMove_GetX(obj) >= -20 && count < limit){
				PlaySoundEffect("se_kira00");
			ObjMove_SetAngle(obj, -ObjMove_GetAngle(obj) + 180);
			count++;
		}

		if(ObjMove_GetX(obj) >= GetStgFrameWidth && ObjMove_GetX(obj) <= GetStgFrameWidth + 20 && count < limit){
				PlaySoundEffect("se_kira00");
			ObjMove_SetAngle(obj, -ObjMove_GetAngle(obj) + 180);
			count++;
		}
		yield;
	}
}

task ObjMove_ReflectSTGWalls(obj, limit,graph){
	let count = 0;
	while(!Obj_IsDeleted(obj)){
	
		if(ObjMove_GetX(obj) <= 130 && ObjMove_GetX(obj) >= 110 && count < limit){
				PlaySoundEffect("se_kira00");
			ObjMove_SetAngle(obj, -ObjMove_GetAngle(obj) + 180);
			ObjShot_SetGraphic(obj,graph);
			count++;
		}

		if(ObjMove_GetX(obj) >= GetStgFrameWidth-130 && ObjMove_GetX(obj) <= GetStgFrameWidth -110 && count < limit){
				PlaySoundEffect("se_kira00");
			ObjMove_SetAngle(obj, -ObjMove_GetAngle(obj) + 180);
			ObjShot_SetGraphic(obj,graph);
			count++;
		}
		yield;
	}
}

