//#include"script/default_system/Default_ShotConst.txt"
#include".\Resources.txt"
#include".\GizmoSpriteLibrary.txt"
#include".\shot\AllStarShot_Const.txt"
let shou;
let kaguya;
let TIME = 99;
let shouX = 0;
let shouY = 0;
let kaguyaX = 0;
let kaguyaY = 0;

@Event
{
	SetTimer(TIME);
    SetLife(471);
    SetScore(10000000);	
}

@Initialize
{
	DeleteShotAll(TYPE_ALL, TYPE_ITEM); 
	SetAutoDeleteObject(true);
	let objScene = GetEnemyBossSceneObjectID();
	ObjEnemyBossScene_StartSpell(objScene);
	
	shou = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	kaguya = ObjEnemy_Create(OBJ_ENEMY);
	
	ObjEnemy_Regist(shou);
	ObjEnemy_Regist(kaguya);
	
	ObjMove_SetPosition(shou,GetCommonData("ShouX",0),GetCommonData("ShouY",0));
	ObjMove_SetPosition(kaguya,GetCommonData("KaguyaX",0),GetCommonData("KaguyaY",0));
	let cx = GetStgFrameWidth() / 3;
	
	renderShouUFO(shou);
	renderKaguyaIN(kaguya);
	
	
	//ObjMove_SetDestAtFrame(shou, cx, 100, 60);
	//ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth()-cx, 100, 60);
	
	
	ObjEnemy_SetLife(kaguya, 471);
	BossManage;
	TMain();
	
	wait(60);
	
	Obj_SetValue(kaguya,"cast",1);
	if(GetCommonData("Difficulty",1) == 1){FireE; KFireE; spellCast("Glorious Treasure: \"Gleaming Flames of Kinkaku-ji\"");}
	else if(GetCommonData("Difficulty",1) == 2){FireN; KFireN;spellCast("Treasure Sign? \"Why Is Kinkaku-ji On Fire?\"");}
	else if(GetCommonData("Difficulty",1) == 3){FireH; KFireH;spellCast("Treasured Treasure: \"Treasured Treasure Worth Treasuring\"");}
	else if(GetCommonData("Difficulty",1) == 4){FireL; KFireL;spellCast("How Precious: \"I Heard You Like Micro-Dodging\"");}
}

@MainLoop
{

	yield;
}

task TMain(){
	ObjEnemy_SetDamageRate(shou,0,0);
	ObjEnemy_SetDamageRate(kaguya,0,0);
	let bossHP = 471*2;
	loop(120){
		bossHP-=471*2/120;
		SetCommonData("BossHealth",bossHP);
		yield;
	}
	ObjEnemy_SetDamageRate(shou,4,100);
	ObjEnemy_SetDamageRate(kaguya,4,100);
	loop{
		if(ObjEnemy_GetInfo(kaguya, INFO_LIFE) < ObjEnemy_GetInfo(shou, INFO_LIFE)){ObjEnemy_SetLife(shou, ObjEnemy_GetInfo(kaguya, INFO_LIFE));}
		else if(ObjEnemy_GetInfo(kaguya, INFO_LIFE) > ObjEnemy_GetInfo(shou, INFO_LIFE)){ObjEnemy_SetLife(kaguya, ObjEnemy_GetInfo(shou, INFO_LIFE));}
		SetCommonData("BossHealth",471-ObjEnemy_GetInfo(shou,INFO_LIFE));
	yield;}	
}

task BossManage{

	while(ObjEnemy_GetInfo(shou,INFO_LIFE)>0){
        shouX = ObjMove_GetX(shou);
        shouY = ObjMove_GetY(shou);
		kaguyaX = ObjMove_GetX(kaguya);
		kaguyaY = ObjMove_GetY(kaguya);
		
		ObjEnemy_SetIntersectionCircleToShot(shou, shouX, shouY, 40);
        ObjEnemy_SetIntersectionCircleToPlayer(shou, shouX, shouY, 30);
		ObjEnemy_SetIntersectionCircleToShot(kaguya, kaguyaX, kaguyaY, 40);
        ObjEnemy_SetIntersectionCircleToPlayer(kaguya, kaguyaX, kaguyaY, 30);
		yield;
	}
	SetCommonData("ShouX",ObjMove_GetX(shou));
	SetCommonData("ShouY",ObjMove_GetY(shou));
	
	SetCommonData("KaguyaX",ObjMove_GetX(kaguya));
	SetCommonData("KaguyaY",ObjMove_GetY(kaguya));
	
	Obj_Delete(shou);
	Obj_Delete(kaguya);
	
	DeleteShotAll(TYPE_ALL, TYPE_FADE);
	SetCommonData("LifebarsRemaining",GetCommonData("LifebarsRemaining",0)-1);
	SetCommonData("SpellsRemaining", GetCommonData("SpellsRemaining", 0)-1);
    CloseScript(GetOwnScriptID()); 
}

task spellCast(name){
	let objText = ObjText_Create();
			Obj_SetRenderPriorityI(objText, 80);
			ObjText_SetFontType(objText, "8bitoperator JVE");
			ObjText_SetFontSize(objText, 16);
			ObjText_SetFontBorderType(objText, BORDER_FULL);
			ObjText_SetFontBorderWidth(objText, 3);
			ObjText_SetFontBorderColor(objText, 0,0,0);
			ObjText_SetFontColorTop(objText, 255,255,255);
			ObjText_SetFontColorBottom(objText, 255,255,255);
			ObjText_SetMaxWidth(objText, 500);
			ObjRender_SetPosition(objText,GetStgFrameWidth/2-237,300,0);
			ObjText_SetText(objText, name);
			wait(60);
			let y = 300;
			let dist = 260/60;
			loop(60){
				ObjRender_SetPosition(objText,GetStgFrameWidth/2-237,y,0);
				y-= dist;
				yield;
			}
			ObjRender_SetPosition(objText,GetStgFrameWidth/2-237,40,0);
}

task KFireL{
	wait(60);
	ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth/2, 100, 60);
	wait(60);
	let angle = 0;
	let angle2 = 0;
	let angle3 = 0;
	loop{
		loop(4){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_AQUA, 10);
			moveBullets(shot, angle, 1);
		}
		if(ObjEnemy_GetInfo(shou,INFO_LIFE) < (471/3) * 2){
			loop(4){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_BLUE, 10);
			moveBullets(shot, angle2, 2);
			}
		
		}
		
		if(ObjEnemy_GetInfo(shou,INFO_LIFE) < (471/3)){
			loop(4){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_PURPLE, 10);
			moveBullets(shot, angle3, 1.5);
			}
		
		}
		wait(6);
		angle += 91.7;
		angle2 += -92.7;
		angle3 += 93.7;
	}
	
	task moveBullets(shot, angle, speed){
		while(ObjMove_GetSpeed(shot) != 0){yield;}
		ObjMove_SetMaxSpeed(shot, speed);
		ObjMove_SetAcceleration(shot, 0.01);
		ObjMove_SetAngle(shot, angle);
	}
}

task KFireH{
	wait(60);
	ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth/2, 100, 60);
	wait(60);
	let angle = 0;
	let angle2 = 0;
	let angle3 = 0;
	loop{
		loop(3){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_AQUA, 10);
			moveBullets(shot, angle, 1);
		}
		if(ObjEnemy_GetInfo(shou,INFO_LIFE) < (471/3) * 2){
			loop(3){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_BLUE, 10);
			moveBullets(shot, angle2, 2);
			}
		
		}
		
		if(ObjEnemy_GetInfo(shou,INFO_LIFE) < (471/3)){
			loop(3){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_PURPLE, 10);
			moveBullets(shot, angle3, 1.5);
			}
		
		}
		wait(10);
		angle += 123.7;
		angle2 += -123.7;
		angle3 += 124.7;
	}
	
	task moveBullets(shot, angle, speed){
		while(ObjMove_GetSpeed(shot) != 0){yield;}
		ObjMove_SetMaxSpeed(shot, speed);
		ObjMove_SetAcceleration(shot, 0.01);
		ObjMove_SetAngle(shot, angle);
	}
}

task KFireN{
	wait(60);
	ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth/2, 100, 60);
	wait(60);
	let angle = 0;
	let angle2 = 0;
	let angle3 = 0;
	loop{
		loop(3){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_AQUA, 10);
			moveBullets(shot, angle, 1);
		}
		if(ObjEnemy_GetInfo(shou,INFO_LIFE) < (471/3) * 2){
			loop(3){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_BLUE, 10);
			moveBullets(shot, angle2, 2);
			}
		
		}
		
		if(ObjEnemy_GetInfo(shou,INFO_LIFE) < (471/3)){
			loop(3){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_PURPLE, 10);
			moveBullets(shot, angle3, 1.5);
			}
		
		}
		wait(10);
		angle += 183.7;
		angle2 += -183.7;
		angle3 += 184.7;
	}
	
	task moveBullets(shot, angle, speed){
		while(ObjMove_GetSpeed(shot) != 0){yield;}
		ObjMove_SetMaxSpeed(shot, speed);
		ObjMove_SetAcceleration(shot, 0.01);
		ObjMove_SetAngle(shot, angle);
	}
}

task KFireE{
	wait(60);
	ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth/2, 100, 60);
	wait(60);
	let angle = 0;
	let angle2 = 0;
	let angle3 = 0;
	loop{
		loop(2){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_AQUA, 10);
			moveBullets(shot, angle, 1);
		}
		if(ObjEnemy_GetInfo(shou,INFO_LIFE) < (471/3) * 2){
			loop(2){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_BLUE, 10);
			moveBullets(shot, angle2, 2);
			}
		
		}
		
		if(ObjEnemy_GetInfo(shou,INFO_LIFE) < (471/3)){
			loop(2){
			let shot = CreateShotA2(kaguyaX, kaguyaY, rand(1,1.5), rand(0, 360), -0.03, 0, SMALL_PURPLE, 10);
			moveBullets(shot, angle3, 1.5);
			}
		
		}
		wait(10);
		angle += 183.7;
		angle2 += -183.7;
		angle3 += 184.7;
	}
	
	task moveBullets(shot, angle, speed){
		while(ObjMove_GetSpeed(shot) != 0){yield;}
		ObjMove_SetMaxSpeed(shot, speed);
		ObjMove_SetAcceleration(shot, 0.01);
		ObjMove_SetAngle(shot, angle);
	}
}

//Lunatic
task FireL(){
wait(60);
	ObjMove_SetDestAtFrame(shou, GetStgFrameWidth/2, 200, 60);
	Obj_SetValue(shou,"cast",1);
	wait(120);
	let n = 1;
	let angle = 0;
	let yBound = 0;
	let delay = 15*40 + 60*3;
	loop{
	loop(24){
		let temp = CreateLooseLaserA1(shouX, shouY, 30, angle, 800, 50, O_LASER_YELLOW, 0);
		wait(10);
		Obj_Delete(temp);
		let objL1 = CreateLooseLaserA1(shouX, shouY, 400, angle, 800, 50, O_LASER_YELLOW, 0);
		ObjShot_SetAutoDelete(objL1, false);
		hostLasers(objL1, -90 + (55 * -n), 4, SMALL_YELLOW);
		//increaseLength(objL1, 400);
		/*
		task increaseLength(laser, length){
			let l = 0;
			let ammount = length/30;
			loop(30){
				ObjLaser_SetLength(laser, l);
				ObjMove_SetSpeed(laser, l*2);
				l += ammount;
				yield;
			}
			ObjLaser_SetLength(laser, length);
			ObjMove_SetSpeed(laser, length*2);
		}
		*/
		task hostLasers(Laser1, angle2, speed, shot){
			let objH = CreateShotA1(shouX, shouY, speed, angle2, shot, 0);
			ObjMove_AddPatternB2(objH, 30, NO_CHANGE, NO_CHANGE, 0, 0.2, NO_CHANGE, 10);
			ObjShot_SetAutoDelete(objH, false);
			ObjShot_SetIntersectionEnable(objH, false);
			ObjRender_SetBlendType(objH, BLEND_ALPHA);
			ObjRender_SetAlpha(objH, 0);
			let i = n;
			let y = yBound;
			let Hx = ObjMove_GetX(objH);
			let Hy = ObjMove_GetY(objH);
			deleteHost(objH, delay);
			while(!Obj_IsDeleted(objH)){
				ObjMove_SetX(Laser1, Hx -60*i);
				ObjMove_SetY(Laser1, Hy);
				if(ObjMove_GetY(objH) >= GetStgFrameHeight - y){
					ObjMove_SetY(objH, GetStgFrameHeight - y);
					ObjMove_AddPatternB2(objH, 0, 0, 0, 0, 0, 0, 0);
				}
				Hx = ObjMove_GetX(objH);
				Hy = ObjMove_GetY(objH);
				yield;
			}
			let temp = 90;
			let speed2 = 1;
			loop(20){
				let shot = CreateShotA1(Hx +30*i, Hy, speed2, temp, FIRE_YELLOW, 30);
				ObjRender_SetBlendType(shot, BLEND_ADD_ARGB);
				Hx += 240/20 * i;
				temp += 61 * i;
				if(speed2 == 1){speed2 = 0.45;}
				else{speed2 = 1;}
				
			}
			Obj_Delete(Laser1);
			
			
			
			
			task deleteHost(obj, delay,){
				wait(delay);
				Obj_Delete(obj);
			}
		
		}	
		angle += 180;
		n*=-1;
		if(n == 1){
			yBound+= 25;
		}
		delay -= 29;
		wait(15);
	}
	
	Obj_SetValue(shou,"cast",0);
	delay = 15*40 + 60*3;
	yBound= 0;
	let tempAngle = 45;
	loop((360-90)/2){
		CreateShotA2(shouX, shouY, 0.1, tempAngle,0.05, 10, LARGE_PURPLE, 30);
		tempAngle-=2;
	}
	wait(60*4);
	Obj_SetValue(shou,"cast",1);
	wait(60);
	}
	
}

//Hard
task FireH(){
	wait(60);
	ObjMove_SetDestAtFrame(shou, GetStgFrameWidth/2, 200, 60);
	Obj_SetValue(shou,"cast",1);
	wait(120);
	let n = 1;
	let angle = 0;
	let yBound = 0;
	let delay = 15*40 + 60*3;
	loop{
	loop(24){
		let temp = CreateLooseLaserA1(shouX, shouY, 30, angle, 800, 50, O_LASER_YELLOW, 0);
		wait(10);
		Obj_Delete(temp);
		let objL1 = CreateLooseLaserA1(shouX, shouY, 400, angle, 800, 50, O_LASER_YELLOW, 0);
		ObjShot_SetAutoDelete(objL1, false);
		hostLasers(objL1, -90 + (57 * -n), 4, SMALL_YELLOW);
		//increaseLength(objL1, 400);
		/*
		task increaseLength(laser, length){
			let l = 0;
			let ammount = length/30;
			loop(30){
				ObjLaser_SetLength(laser, l);
				ObjMove_SetSpeed(laser, l*2);
				l += ammount;
				yield;
			}
			ObjLaser_SetLength(laser, length);
			ObjMove_SetSpeed(laser, length*2);
		}
		*/
		task hostLasers(Laser1, angle2, speed, shot){
			let objH = CreateShotA1(shouX, shouY, speed, angle2, shot, 0);
			ObjMove_AddPatternB2(objH, 30, NO_CHANGE, NO_CHANGE, 0, 0.2, NO_CHANGE, 10);
			ObjShot_SetAutoDelete(objH, false);
			ObjShot_SetIntersectionEnable(objH, false);
			ObjRender_SetBlendType(objH, BLEND_ALPHA);
			ObjRender_SetAlpha(objH, 0);
			let i = n;
			let y = yBound;
			let Hx = ObjMove_GetX(objH);
			let Hy = ObjMove_GetY(objH);
			deleteHost(objH, delay);
			while(!Obj_IsDeleted(objH)){
				ObjMove_SetX(Laser1, Hx -60*i);
				ObjMove_SetY(Laser1, Hy);
				if(ObjMove_GetY(objH) >= GetStgFrameHeight - y){
					ObjMove_SetY(objH, GetStgFrameHeight - y);
					ObjMove_AddPatternB2(objH, 0, 0, 0, 0, 0, 0, 0);
				}
				Hx = ObjMove_GetX(objH);
				Hy = ObjMove_GetY(objH);
				yield;
			}
			let temp = 90;
			let speed2 = 1;
			loop(20){
				let shot = CreateShotA1(Hx +30*i, Hy, speed2, temp, FIRE_YELLOW, 30);
				ObjRender_SetBlendType(shot, BLEND_ADD_ARGB);
				Hx += 240/20 * i;
				temp += 61 * i;
				if(speed2 == 1){speed2 = 0.4;}
				else{speed2 = 1;}
				
			}
			Obj_Delete(Laser1);
			
			
			
			
			task deleteHost(obj, delay,){
				wait(delay);
				Obj_Delete(obj);
			}
		
		}	
		angle += 180;
		n*=-1;
		if(n == 1){
			yBound+= 25;
		}
		delay -= 29;
		wait(15);
	}
	
	Obj_SetValue(shou,"cast",0);
	delay = 15*40 + 60*3;
	yBound= 0;
	let tempAngle = 45;
	loop((360-90)/2){
		CreateShotA2(shouX, shouY, 0.1, tempAngle,0.05, 10, LARGE_PURPLE, 30);
		tempAngle-=2;
	}
	wait(60*4);
	Obj_SetValue(shou,"cast",1);
	wait(60);
	}
	
}

//Normal
task FireN(){
wait(60);
	ObjMove_SetDestAtFrame(shou, GetStgFrameWidth/2, 200, 60);
	Obj_SetValue(shou,"cast",1);
	wait(120);
	let n = 1;
	let angle = 0;
	let yBound = 0;
	let delay = 15*40 + 60*3;
	loop{
	loop(18){
		let temp = CreateLooseLaserA1(shouX, shouY, 30, angle, 800, 50, O_LASER_YELLOW, 0);
		wait(10);
		Obj_Delete(temp);
		let objL1 = CreateLooseLaserA1(shouX, shouY, 400, angle, 800, 50, O_LASER_YELLOW, 0);
		ObjShot_SetAutoDelete(objL1, false);
		hostLasers(objL1, -90 + (57 * -n), 4, SMALL_YELLOW);
		//increaseLength(objL1, 400);
		/*
		task increaseLength(laser, length){
			let l = 0;
			let ammount = length/30;
			loop(30){
				ObjLaser_SetLength(laser, l);
				ObjMove_SetSpeed(laser, l*2);
				l += ammount;
				yield;
			}
			ObjLaser_SetLength(laser, length);
			ObjMove_SetSpeed(laser, length*2);
		}
		*/
		task hostLasers(Laser1, angle2, speed, shot){
			let objH = CreateShotA1(shouX, shouY, speed, angle2, shot, 0);
			ObjMove_AddPatternB2(objH, 30, NO_CHANGE, NO_CHANGE, 0, 0.2, NO_CHANGE, 10);
			ObjShot_SetAutoDelete(objH, false);
			ObjShot_SetIntersectionEnable(objH, false);
			ObjRender_SetBlendType(objH, BLEND_ALPHA);
			ObjRender_SetAlpha(objH, 0);
			let i = n;
			let y = yBound;
			let Hx = ObjMove_GetX(objH);
			let Hy = ObjMove_GetY(objH);
			deleteHost(objH, delay);
			while(!Obj_IsDeleted(objH)){
				ObjMove_SetX(Laser1, Hx -60*i);
				ObjMove_SetY(Laser1, Hy);
				if(ObjMove_GetY(objH) >= GetStgFrameHeight - y){
					ObjMove_SetY(objH, GetStgFrameHeight - y);
					ObjMove_AddPatternB2(objH, 0, 0, 0, 0, 0, 0, 0);
				}
				Hx = ObjMove_GetX(objH);
				Hy = ObjMove_GetY(objH);
				yield;
			}
			let temp = 90;
			let speed2 = 1;
			loop(20){
				let shot = CreateShotA1(Hx +30*i, Hy, speed2, temp, FIRE_YELLOW, 30);
				ObjRender_SetBlendType(shot, BLEND_ADD_ARGB);
				Hx += 240/20 * i;
				temp += 61 * i;
				if(speed2 == 1){speed2 = 0.35;}
				else{speed2 = 1;}
				
			}
			Obj_Delete(Laser1);
			
			
			
			
			task deleteHost(obj, delay,){
				wait(delay);
				Obj_Delete(obj);
			}
		
		}	
		angle += 180;
		n*=-1;
		if(n == 1){
			yBound+= 25;
		}
		delay -= 35;
		wait(20);
	}
	
	Obj_SetValue(shou,"cast",0);
	delay = 15*40 + 60*3;
	yBound= 0;
	let tempAngle = 45;
	loop((360-90)/2){
		CreateShotA2(shouX, shouY, 0.1, tempAngle,0.05, 10, LARGE_PURPLE, 30);
		tempAngle-=2;
	}
	wait(60*4);
	Obj_SetValue(shou,"cast",1);
	wait(60);
	}
	
}

//Easy
task FireE(){
	
	wait(60);
	ObjMove_SetDestAtFrame(shou, GetStgFrameWidth/2, 200, 60);
	Obj_SetValue(shou,"cast",1);
	wait(120);
	let n = 1;
	let angle = 0;
	let yBound = 0;
	let delay = 15*40 + 60*3;
	loop{
	loop(14){
		let temp = CreateLooseLaserA1(shouX, shouY, 30, angle, 800, 50, O_LASER_YELLOW, 0);
		wait(10);
		Obj_Delete(temp);
		let objL1 = CreateLooseLaserA1(shouX, shouY, 400, angle, 800, 50, O_LASER_YELLOW, 0);
		ObjShot_SetAutoDelete(objL1, false);
		hostLasers(objL1, -90 + (60 * -n), 4, SMALL_YELLOW);
		//increaseLength(objL1, 400);
		/*
		task increaseLength(laser, length){
			let l = 0;
			let ammount = length/30;
			loop(30){
				ObjLaser_SetLength(laser, l);
				ObjMove_SetSpeed(laser, l*2);
				l += ammount;
				yield;
			}
			ObjLaser_SetLength(laser, length);
			ObjMove_SetSpeed(laser, length*2);
		}
		*/
		task hostLasers(Laser1, angle2, speed, shot){
			let objH = CreateShotA1(shouX, shouY, speed, angle2, shot, 0);
			ObjMove_AddPatternB2(objH, 30, NO_CHANGE, NO_CHANGE, 0, 0.2, NO_CHANGE, 10);
			ObjShot_SetAutoDelete(objH, false);
			ObjShot_SetIntersectionEnable(objH, false);
			ObjRender_SetBlendType(objH, BLEND_ALPHA);
			ObjRender_SetAlpha(objH, 0);
			let i = n;
			let y = yBound;
			let Hx = ObjMove_GetX(objH);
			let Hy = ObjMove_GetY(objH);
			deleteHost(objH, delay);
			while(!Obj_IsDeleted(objH)){
				ObjMove_SetX(Laser1, Hx -60*i);
				ObjMove_SetY(Laser1, Hy);
				if(ObjMove_GetY(objH) >= GetStgFrameHeight - y){
					ObjMove_SetY(objH, GetStgFrameHeight - y);
					ObjMove_AddPatternB2(objH, 0, 0, 0, 0, 0, 0, 0);
				}
				Hx = ObjMove_GetX(objH);
				Hy = ObjMove_GetY(objH);
				yield;
			}
			let temp = 90;
			let speed2 = 1;
			loop(20){
				let shot = CreateShotA1(Hx +30*i, Hy, speed2, temp, FIRE_YELLOW, 30);
				ObjRender_SetBlendType(shot, BLEND_ADD_ARGB);
				Hx += 240/20 * i;
				temp += 61 * i;
				if(speed2 == 1){speed2 = 0.3;}
				else{speed2 = 1;}
				
			}
			Obj_Delete(Laser1);
			
			
			
			
			task deleteHost(obj, delay,){
				wait(delay);
				Obj_Delete(obj);
			}
		
		}	
		angle += 180;
		n*=-1;
		if(n == 1){
			yBound+= 25;
		}
		delay -= 39;
		wait(26);
	}
	
	Obj_SetValue(shou,"cast",0);
	delay = 15*40 + 60*3;
	yBound= 0;
	let tempAngle = 45;
	loop((360-90)/2){
		CreateShotA2(shouX, shouY, 0.1, tempAngle,0.05, 10, LARGE_PURPLE, 30);
		tempAngle-=2;
	}
	wait(60*4);
	Obj_SetValue(shou,"cast",1);
	wait(60);
	}
}



