//#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);
	
	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){SFireE; KFireE;}
	else if(GetCommonData("Difficulty",1) == 2){SFireN; KFireN;}
	else if(GetCommonData("Difficulty",1) == 3){SFireH; KFireH;}
	else if(GetCommonData("Difficulty",1) == 4){SFireL; KFireL;}
}

@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,8,100);
	ObjEnemy_SetDamageRate(kaguya,8,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 KFireL{
wait (60);
	ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth - (GetStgFrameWidth/7), 100, 60);
	wait(60);
	shootShot1(0);
	moveBoss;
	
	task shootShot1(angle){
		wait(120);
		
		let n = 4;
		let speed = 4;
		let temp = -1;
		loop(4){
			let delay = 35*n + 60*n;
			loop(36){
				let shot = CreateShotA2(kaguyaX,kaguyaY,speed,angle, -0.1, 0,PELLET_GRAY,10);
				
				moveShot(shot, temp, angle, delay);
				wait(1);
				angle += 10;
				delay--;
				temp *= -1;
			}
			speed-= 0.5;
			n--;
			
		}
	}
	
	
	task moveShot(shot, n, angle, delay){
		
		while(!Obj_IsDeleted(shot)){
			if(ObjMove_GetSpeed(shot) <= 0){
				wait(120 + delay);
				if(n == 1){
					
					let temp = 0;
					let temp2 = rand(51, 63);
					let temp3 = 0;
					let temp4 = 0;
					loop(7){
						let s1 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) + (temp3)+140, 0.1, 4,temp2,10);
						let s2 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) - (temp3)+140, 0.1,4,temp2,10);
						temp -= 0.5;
						temp3+=0.7;
						
						temp4 += 0.000174;
					}
					Obj_Delete(shot);
					
				}
				if(n == -1){
					
					
					let temp = 0;
					let temp2 = rand(51, 63);
					let temp3 = 0;
					let temp4 = 0;
					loop(7){
						let s1 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) +(temp3)-140, 0.1, 4,temp2,10);
						let s2 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) -(temp3)-140, 0.1,4,temp2,10);
						temp -= 0.5;
						temp3+=0.7;
						
						temp4 += 0.000174;
					}
					Obj_Delete(shot);
					
				}
				
				//Obj_Delete(shot);
				break;
			}
			yield;
		}
	}
	task moveBoss(){
		let n = 1;
		while(!Obj_IsDeleted(kaguya)){
			wait(60*5);
			
			if(n == 0){
				ObjMove_SetDestAtFrame(kaguya, (GetStgFrameWidth) - (GetStgFrameWidth/7), 100, 120);
				n = 1;
				let angle = rand(0,360);
				shootShot1(angle);
			}
			else{
				ObjMove_SetDestAtFrame(kaguya,(GetStgFrameWidth/7), 100, 120);
				n = 0;
				let angle = rand(0,360);
				shootShot1(angle);
			}
		}
	}
}

task KFireH{
wait (60);
	ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth - (GetStgFrameWidth/7), 100, 60);
	wait(60);
	shootShot1(0);
	moveBoss;
	
	task shootShot1(angle){
		wait(120);
		
		let n = 4;
		let speed = 4;
		let temp = -1;
		loop(4){
			let delay = 35*n + 60*n;
			loop(36){
				let shot = CreateShotA2(kaguyaX,kaguyaY,speed,angle, -0.1, 0,PELLET_GRAY,10);
				
				moveShot(shot, temp, angle, delay);
				wait(1);
				angle += 10;
				delay--;
				temp *= -1;
			}
			speed-= 0.5;
			n--;
			
		}
	}
	
	
	task moveShot(shot, n, angle, delay){
		
		while(!Obj_IsDeleted(shot)){
			if(ObjMove_GetSpeed(shot) <= 0){
				wait(120 + delay);
				if(n == 1){
					
					let temp = 0;
					let temp2 = rand(51, 63);
					let temp3 = 0;
					loop(4){
						let s1 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) + temp3 +110, 0.1, 3.7,temp2,3);
						let s2 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) - temp3 + 110, 0.1, 3.7,temp2,3);
						temp -= 0.3;
						temp3++;
						
					}
					Obj_Delete(shot);
					
				}
				if(n == -1){
					
					let temp = 0;
					let temp2 = rand(51, 63);
					let temp3 = 0;
					loop(4){
						let s1 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) + temp3-110, 0.1, 3.7,temp2,3);
						let s2 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) - temp3-110, 0.1, 3.7,temp2,3);
						temp -= 0.3;
						temp3++;
						
					}
					Obj_Delete(shot);
					
				}
				
				//Obj_Delete(shot);
				break;
			}
			yield;
		}
	}
	task moveBoss(){
		let n = 1;
		while(!Obj_IsDeleted(kaguya)){
			wait(60*5);
			
			if(n == 0){
				ObjMove_SetDestAtFrame(kaguya, (GetStgFrameWidth) - (GetStgFrameWidth/7), 100, 120);
				n = 1;
				let angle = rand(0,360);
				shootShot1(angle);
			}
			else{
				ObjMove_SetDestAtFrame(kaguya,(GetStgFrameWidth/7), 100, 120);
				n = 0;
				let angle = rand(0,360);
				shootShot1(angle);
			}
		}
	}
}

task KFireN{
wait (60);
	ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth - (GetStgFrameWidth/7), 100, 60);
	wait(60);
	shootShot1(0);
	moveBoss;
	
	task shootShot1(angle){
		wait(120);
		
		let n = 4;
		let speed = 4;
		let temp = -1;
		loop(4){
			let delay = 35*n + 60*n;
			loop(36){
				let shot = CreateShotA2(kaguyaX,kaguyaY,speed,angle, -0.1, 0,PELLET_GRAY,10);
				
				moveShot(shot, temp, angle, delay);
				wait(1);
				angle += 10;
				delay--;
				temp *= -1;
			}
			speed-= 0.5;
			n--;
			
		}
	}
	
	
	task moveShot(shot, n, angle, delay){
		
		while(!Obj_IsDeleted(shot)){
			if(ObjMove_GetSpeed(shot) <= 0){
				wait(120 + delay);
				if(n == 1){
					
					let temp = 0;
					let temp2 = rand(51, 63);
					let temp3 = 0;
					loop(4){
						let s1 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) + temp3 +110, 0.1, 3.7,temp2,3);
						let s2 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) - temp3 + 110, 0.1, 3.7,temp2,3);
						temp -= 0.3;
						temp3+=0.7;
						
					}
					Obj_Delete(shot);
					
				}
				if(n == -1){
					
					let temp = 0;
					let temp2 = rand(51, 63);
					let temp3 = 0;
					loop(4){
						let s1 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) + temp3-110, 0.1, 3.7,temp2,3);
						let s2 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) - temp3-110, 0.1, 3.7,temp2,3);
						temp -= 0.3;
						temp3+=0.7;
						
					}
					Obj_Delete(shot);
					
				}
				
				//Obj_Delete(shot);
				break;
			}
			yield;
		}
	}
	task moveBoss(){
		let n = 1;
		while(!Obj_IsDeleted(kaguya)){
			wait(60*5);
			
			if(n == 0){
				ObjMove_SetDestAtFrame(kaguya, (GetStgFrameWidth) - (GetStgFrameWidth/7), 100, 120);
				n = 1;
				let angle = rand(0,360);
				shootShot1(angle);
			}
			else{
				ObjMove_SetDestAtFrame(kaguya,(GetStgFrameWidth/7), 100, 120);
				n = 0;
				let angle = rand(0,360);
				shootShot1(angle);
			}
		}
	}
}


task KFireE{
wait (60);
	ObjMove_SetDestAtFrame(kaguya, GetStgFrameWidth - (GetStgFrameWidth/7), 100, 60);
	wait(60);
	shootShot1(0);
	moveBoss;
	
	task shootShot1(angle){
		wait(120);
		
		let n = 4;
		let speed = 4;
		let temp = -1;
		loop(4){
			let delay = 35*n + 60*n;
			loop(36){
				let shot = CreateShotA2(kaguyaX,kaguyaY,speed,angle, -0.1, 0,PELLET_GRAY,10);
				
				moveShot(shot, temp, angle, delay);
				wait(1);
				angle += 10;
				delay--;
				temp *= -1;
			}
			speed-= 0.5;
			n--;
			
		}
	}
	
	
	task moveShot(shot, n, angle, delay){
		
		while(!Obj_IsDeleted(shot)){
			if(ObjMove_GetSpeed(shot) <= 0){
				wait(120 + delay);
				if(n == 1){
					
					let temp = 0;
					let temp2 = rand(51, 63);
					let temp3 = 0;
					loop(3){
						let s1 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) + temp3 +110, 0.1, 3.7,temp2,3);
						let s2 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) - temp3 + 110, 0.1, 3.7,temp2,3);
						temp -= 0.3;
						temp3+=0.5;
						
					}
					Obj_Delete(shot);
					
				}
				if(n == -1){
					
					let temp = 0;
					let temp2 = rand(51, 63);
					let temp3 = 0;
					loop(3){
						let s1 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) + temp3-110, 0.1, 3.7,temp2,3);
						let s2 = CreateShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),2+temp,ObjMove_GetAngle(shot) - temp3-110, 0.1, 3.7,temp2,3);
						temp -= 0.3;
						temp3+=0.5;
						
					}
					Obj_Delete(shot);
					
				}
				
				//Obj_Delete(shot);
				break;
			}
			yield;
		}
	}
	task moveBoss(){
		let n = 1;
		while(!Obj_IsDeleted(kaguya)){
			wait(60*5);
			
			if(n == 0){
				ObjMove_SetDestAtFrame(kaguya, (GetStgFrameWidth) - (GetStgFrameWidth/7), 100, 120);
				n = 1;
				let angle = rand(0,360);
				shootShot1(angle);
			}
			else{
				ObjMove_SetDestAtFrame(kaguya,(GetStgFrameWidth/7), 100, 120);
				n = 0;
				let angle = rand(0,360);
				shootShot1(angle);
			}
		}
	}
}

//Lunatic
task SFireL(){
	Obj_SetValue(shou,"cast",0);
	wait (60);
	ObjMove_SetDestAtFrame(shou, GetStgFrameWidth/2, 200, 60);
	wait(60);
	let angle = rand(0,360);
	let angle2 = rand(0,360);
	Obj_SetValue(shou,"cast",1);
	let n = 1;
	wait(10);
	loop{
		angle = rand(0,360);
			loop(10){
				let cLaser = CreateCurveLaserA1(shouX, shouY, 4, angle, 30, 15, C_LASER_YELLOW, 0);
				ObjCrLaser_SetTipDecrement(cLaser, 0);
				ObjMove_SetAngularVelocity(cLaser, 10*n);
				ObjMove_SetMaxSpeed(cLaser, 0);
				ObjMove_SetAcceleration(cLaser, 0);
				moveShot(cLaser, n);
				angle += 360/10;
				
			}
			wait(20);
			n *= -1;
			loop(10){
				let cLaser = CreateCurveLaserA1(shouX, shouY, 4, angle, 30, 15, C_LASER_YELLOW, 0);
				ObjCrLaser_SetTipDecrement(cLaser, 0);
				ObjMove_SetAngularVelocity(cLaser, 10*n);
				ObjMove_SetMaxSpeed(cLaser, 0);
				ObjMove_SetAcceleration(cLaser, 0);
				moveShot(cLaser, n);
				angle += 360/10;
				
			}
			wait(20);
			n *= -1;
			loop(10){
				let cLaser = CreateCurveLaserA1(shouX, shouY, 3, angle, 30, 15, C_LASER_YELLOW, 0);
				ObjCrLaser_SetTipDecrement(cLaser, 0);
				ObjMove_SetAngularVelocity(cLaser, 10*n);
				ObjMove_SetMaxSpeed(cLaser, 0);
				ObjMove_SetAcceleration(cLaser, 0);
				moveShot(cLaser, n);
				angle += 360/10;
				
			}
			n *= -1;
			loop(10){
				let cLaser = CreateCurveLaserA1(shouX, shouY, 3, angle, 30, 15, C_LASER_YELLOW, 0);
				ObjCrLaser_SetTipDecrement(cLaser, 0);
				ObjMove_SetAngularVelocity(cLaser, 10*n);
				ObjMove_SetMaxSpeed(cLaser, 0);
				ObjMove_SetAcceleration(cLaser, 0);
				moveShot(cLaser, n);
				angle += 360/10;
				
			}
			n *= -1;
			wait(30);
			loop(10){
				let cLaser2 = CreateCurveLaserA1(shouX, shouY, 0.1, angle, 30, 15, C_LASER_RED, 0);
				ObjCrLaser_SetTipDecrement(cLaser2, 0);
				ObjMove_SetAngularVelocity(cLaser2, 1*n);
				ObjMove_SetMaxSpeed(cLaser2, 20);
				ObjMove_SetAcceleration(cLaser2, 0.05);
				angle += 360/10;
			}
			wait(10);
			n *= -1;
			loop(10){
				let cLaser2 = CreateCurveLaserA1(shouX, shouY, 0.1, angle, 30, 15, C_LASER_RED, 0);
				ObjCrLaser_SetTipDecrement(cLaser2, 0);
				ObjMove_SetAngularVelocity(cLaser2, 1*n);
				ObjMove_SetMaxSpeed(cLaser2, 20);
				ObjMove_SetAcceleration(cLaser2, 0.05);
				angle += 360/10;
			}
			wait(30);
			angle2 = GetAngleToPlayer(shou);
			loop(25){
				let temp = 0;
				loop(3){
					CreateShotA1(shouX, shouY, 2.5 + temp, angle2, LARGE_PURPLE, 30);
					temp += 0.5;
				}
				angle2 += 360/25;
			}
			Obj_SetValue(shou,"cast",0);
			wait(150);
			Obj_SetValue(shou,"cast",1);
			wait(10);
		n *= -1;
	}
	
	task moveShot(shot, n){
		while(!Obj_IsDeleted(shot)){
			wait(30);
			ObjMove_SetAngularVelocity(shot, -8*n);
			wait(40);
			ObjMove_SetAngularVelocity(shot, 5*n);
			wait(60);
			ObjMove_SetAngularVelocity(shot, -4*n);
			wait(60);
			ObjMove_SetAngularVelocity(shot, 0);
			ObjMove_SetAcceleration(shot, 0.15);
			ObjMove_SetMaxSpeed(shot, 20);
			break;
		}
	}
}

//Hard
task SFireH(){
		Obj_SetValue(shou,"cast",0);
	wait (60);
	ObjMove_SetDestAtFrame(shou, GetStgFrameWidth/2, 200, 60);
	wait(60);
	let angle = rand(0,360);
	let angle2 = rand(0,360);
	Obj_SetValue(shou,"cast",1);
	let n = 1;
	wait(10);
	loop{
		angle = rand(0,360);
			loop(10){
				let cLaser = CreateCurveLaserA1(shouX, shouY, 4, angle, 30, 15, C_LASER_YELLOW, 0);
				ObjCrLaser_SetTipDecrement(cLaser, 0);
				ObjMove_SetAngularVelocity(cLaser, 10*n);
				ObjMove_SetMaxSpeed(cLaser, 0);
				ObjMove_SetAcceleration(cLaser, 0);
				moveShot(cLaser, n);
				angle += 360/10;
				
			}
			wait(30);
			n *= -1;
			loop(10){
				let cLaser = CreateCurveLaserA1(shouX, shouY, 4, angle, 30, 15, C_LASER_YELLOW, 0);
				ObjCrLaser_SetTipDecrement(cLaser, 0);
				ObjMove_SetAngularVelocity(cLaser, 10*n);
				ObjMove_SetMaxSpeed(cLaser, 0);
				ObjMove_SetAcceleration(cLaser, 0);
				moveShot(cLaser, n);
				angle += 360/10;
				
			}
			n *= -1;
			wait(60);
			loop(10){
				let cLaser2 = CreateCurveLaserA1(shouX, shouY, 0.1, angle, 30, 15, C_LASER_RED, 0);
				ObjCrLaser_SetTipDecrement(cLaser2, 0);
				ObjMove_SetAngularVelocity(cLaser2, 1*n);
				ObjMove_SetMaxSpeed(cLaser2, 20);
				ObjMove_SetAcceleration(cLaser2, 0.05);
				angle += 360/10;
			}
			wait(10);
			wait(30);
			angle2 = GetAngleToPlayer(shou);
			loop(20){
				let temp = 0;
				loop(3){
					CreateShotA1(shouX, shouY, 2.5 + temp, angle2, LARGE_PURPLE, 30);
					temp += 0.5;
				}
				angle2 += 360/20;
			}
			Obj_SetValue(shou,"cast",0);
			wait(150);
			Obj_SetValue(shou,"cast",1);
			wait(10);
		n *= -1;
	}
	
	task moveShot(shot, n){
		while(!Obj_IsDeleted(shot)){
			wait(30);
			ObjMove_SetAngularVelocity(shot, -8*n);
			wait(40);
			ObjMove_SetAngularVelocity(shot, 5*n);
			wait(60);
			ObjMove_SetAngularVelocity(shot, -4*n);
			wait(60);
			ObjMove_SetAngularVelocity(shot, 0);
			ObjMove_SetAcceleration(shot, 0.15);
			ObjMove_SetMaxSpeed(shot, 20);
			break;
		}
	}
}

//Normal
task SFireN(){
Obj_SetValue(shou,"cast",0);
	wait (60);
	ObjMove_SetDestAtFrame(shou, GetStgFrameWidth/2, 200, 60);
	wait(60);
	let angle = rand(0,360);
	let angle2 = rand(0,360);
	Obj_SetValue(shou,"cast",1);
	let n = 1;
	wait(10);
	loop{
		angle = rand(0,360);
			loop(10){
				let cLaser = CreateCurveLaserA1(shouX, shouY, 4, angle, 30, 15, C_LASER_YELLOW, 0);
				ObjCrLaser_SetTipDecrement(cLaser, 0);
				ObjMove_SetAngularVelocity(cLaser, 10*n);
				ObjMove_SetMaxSpeed(cLaser, 0);
				ObjMove_SetAcceleration(cLaser, 0);
				moveShot(cLaser, n);
				angle += 360/10;
				
			}
			
			wait(90);
			loop(10){
				let cLaser2 = CreateCurveLaserA1(shouX, shouY, 0.1, angle, 30, 15, C_LASER_RED, 0);
				ObjCrLaser_SetTipDecrement(cLaser2, 0);
				ObjMove_SetAngularVelocity(cLaser2, 1*n);
				ObjMove_SetMaxSpeed(cLaser2, 20);
				ObjMove_SetAcceleration(cLaser2, 0.05);
				angle += 360/10;
			}
			n *= -1;
			wait(30);
			angle2 = GetAngleToPlayer(shou);
			loop(20){
				CreateShotA1(shouX, shouY, 2.5, angle2, LARGE_PURPLE, 30);
				angle2 += 360/20;
			}
			Obj_SetValue(shou,"cast",0);
			wait(150);
			Obj_SetValue(shou,"cast",1);
			wait(10);
		
	}
	
	task moveShot(shot, n){
		while(!Obj_IsDeleted(shot)){
			wait(30);
			ObjMove_SetAngularVelocity(shot, -8*n);
			wait(40);
			ObjMove_SetAngularVelocity(shot, 5*n);
			wait(60);
			ObjMove_SetAngularVelocity(shot, -4*n);
			wait(60);
			ObjMove_SetAngularVelocity(shot, 0);
			ObjMove_SetAcceleration(shot, 0.15);
			ObjMove_SetMaxSpeed(shot, 20);
			break;
		}
	}
}

//Easy
task SFireE(){
	Obj_SetValue(shou,"cast",0);
	wait (60);
	ObjMove_SetDestAtFrame(shou, GetStgFrameWidth/2, 200, 60);
	wait(60);
	let angle = rand(0,360);
	let angle2 = rand(0,360);
	Obj_SetValue(shou,"cast",1);
	let n = 1;
	wait(10);
	loop{
		angle = rand(0,360);
		angle2 = rand(0,360);
			loop(10){
				let cLaser = CreateCurveLaserA1(shouX, shouY, 3, angle, 30, 15, C_LASER_YELLOW, 0);
				ObjCrLaser_SetTipDecrement(cLaser, 0);
				ObjMove_SetAngularVelocity(cLaser, 10*n);
				ObjMove_SetMaxSpeed(cLaser, 0);
				ObjMove_SetAcceleration(cLaser, 0);
				moveShot(cLaser, n);
				angle += 360/10;
			}
			n *= -1;
			wait(120);
			loop(20){
				CreateShotA1(shouX, shouY, 2.5, angle2, LARGE_PURPLE, 30);
				angle2 += 360/20;
			}
			Obj_SetValue(shou,"cast",0);
			wait(150);
			Obj_SetValue(shou,"cast",1);
			wait(10);
		
	}
	
	task moveShot(shot, n){
		while(!Obj_IsDeleted(shot)){
			wait(30);
			ObjMove_SetAngularVelocity(shot, -8*n);
			wait(40);
			ObjMove_SetAngularVelocity(shot, 5*n);
			wait(60);
			ObjMove_SetAngularVelocity(shot, -4*n);
			wait(60);
			ObjMove_SetAngularVelocity(shot, 0);
			ObjMove_SetAcceleration(shot, 0.15);
			ObjMove_SetMaxSpeed(shot, 20);
			break;
		}
	}
}



