script_enemy_main {
		
		#include_function".\Halo.txt";
	
	let frame = 0;
	let frame2 = 0;
	let CSD = GetCurrentScriptDirectory;
	let f = 0;
	let f2 = 0;
	let f3 = 0;
	let attack = 0;
	let hover = 0;
	let hovertrue = 0;
	let imgBoss = CSD ~ "system\eirinsprite.png";
	

	@Initialize{
		LoadUserShotData(CSD ~ "ZUN's Shotdata2.txt");
		SetLife(6000);
		LoadGraphic(imgBoss);
		SetDamageRate(0,0);		
		mainTask;
	}
	@MainLoop{	
		SetCollisionA(GetX, GetY, 40);
		SetCollisionB(GetX, GetY, 35);
		if(GetHitCount>0){PlaySE(CSD ~ "sfx\se_nodamage.wav");}
		yield;
	}
	@DrawLoop{		
		SetTexture(imgBoss);
		SetRenderState(ALPHA);
		SetAlpha(255);
		SetGraphicScale(1,1);
		SetGraphicAngle(0,0,0);		
		
		if(int(GetSpeedX())==0){
			if(f<3){SetGraphicRect(0,0,64,80);}
			f2=0;
		}
		
		if(GetSpeedX()>0){
			if(f2<3){SetGraphicRect(0,80,64,160);}
			if(f2>=3 && f2<6){SetGraphicRect(64,80,128,160);}
			if(f2>=6 && f2<9){SetGraphicRect(128,80,192,160);}
			if(f2>=9){SetGraphicRect(192,80,256,160);}
			f2++;		
			hovertrue=0;
		}
		if(GetSpeedX()<0){
			SetGraphicAngle(180,0,0);
			if(f2<3){SetGraphicRect(0,80,64,160);}
			if(f2>=3 && f2<6){SetGraphicRect(64,80,128,160);}
			if(f2>=6 && f2<9){SetGraphicRect(128,80,192,160);}
			if(f2>=9){SetGraphicRect(192,80,256,160);}
			f2++;		
			hovertrue=0;
		}
		
		if (attack==1){
			f3++;
			if(f3<3){SetGraphicRect(0,160,64,240);}
			if(f3>=3 && f3<6){SetGraphicRect(64,160,128,240);}
			if(f3>=6 && f3<9){SetGraphicRect(128,160,192,240);}
			if(f3>=9){SetGraphicRect(192,160,256,240);}
			hovertrue=0;
		}
		if (attack==0){
			f3=0;
			hovertrue=1;
		}
		if(hovertrue==1){hover++;}
		if(hovertrue==0){hover=0;}
		DrawGraphic(GetX,GetY+(6*sin(hover*3)));
	}
	@Finalize{
		yield;
	}
	
	task mainTask{		
		SetMovePosition03(GetCenterX,GetCenterY-120,10,4);
		wait(140);		
		nonspell;
		yield;
	}
	
	task nonspell{
		let dir = 0;
		let x = 0;
		attack=1;
		loop(108){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(8){
		CreateShotA(1,GetX,GetY,20);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,rand(4,7),dir,1,-0.1,1.5,141);
		SetShotDataA(1,60,NULL,NULL,0,-0.1,1.5,141);
		FireShot(1);
		
		CreateShotA(1,GetX,GetY,20);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,6,-dir,-1,-0.1,1.5,140);
		SetShotDataA(1,60,NULL,NULL,0,-0.1,1.5,140);
		FireShot(1);
		
		dir+=360/8;
		}
		dir+=rand(-3,10);
		wait(5);
		}
		attack=0;
		wait(60);
		attack=1;
		loop(5){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(200){
		CreateShotA(1,GetX,GetY,0);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,rand(5,8.5),rand(0,360),rand(-0.5,0.5),-0.2,0,92);
		SetShotDataA(1,60,0,NULL,3,0.1,4,92);
		SetShotDataA(1,120,4,NULL,0,-rand(0.01,0.1),2,92);
		FireShot(1);
		}
		wait(60);
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(200){
		CreateShotA(1,GetX,GetY,0);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,rand(5,8.5),rand(0,360),rand(-0.5,0.5),-0.2,0,90);
		SetShotDataA(1,60,0,NULL,-3,0.1,4,90);
		SetShotDataA(1,120,4,NULL,0,-rand(0.01,0.1),2,90);
		FireShot(1);
		}
		wait(60);
		}
		attack=0;
		wait(100);
		spell1;
		yield;
	}
	
	task spell1{
		let speed = 7;
		let dir = 0;
	
		PlaySE(CSD ~ "sfx\se_ch00.wav");
		Concentration01(60);
		attack=1;
		wait(60);
		
		speed=7;
		while(speed>1){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(12){
		CreateShotA(1,GetX-20,GetY-30,10);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,speed,dir,0,-0.05,0,93);
		SetShotDataA(1,120,0,NULL,1,0.05,2,94);
		SetShotDataA(1,180,NULL,NULL,0,0.1,2,94);
		FireShot(1);
		dir+=360/12;
		}
		dir+=rand(4,8);
		speed+= -0.3;
		wait(4);
		}
		wait(90);
		
		speed=7;
		while(speed>1){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(12){
		CreateShotA(1,GetX-20,GetY-30,10);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,speed,-dir,0,-0.05,0,93);
		SetShotDataA(1,120,0,NULL,-1,0.05,2,94);
		SetShotDataA(1,180,NULL,NULL,0,0.1,2,94);
		FireShot(1);
		dir+=360/12;
		}
		dir+= rand(4,8);
		speed+= -0.3;
		wait(4);
		}
		wait(30);
		PlaySE(CSD ~ "sfx\se_ch02.wav");
		Concentration01(60);
		wait(60);
		
		speed=7;
		while(speed>1){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(12){
		CreateShotA(1,GetX-20,GetY-30,10);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,speed,dir,0,-0.05,0,93);
		SetShotDataA(1,120,0,NULL,2,0.05,2,94);
		SetShotDataA(1,180,NULL,NULL,0,0.1,2,94);
		FireShot(1);
		dir+=360/12;
		}
		dir+=rand(4,8);
		speed+= -0.3;
		wait(4);
		}
		wait(90);
		
		speed=7;
		while(speed>1){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(12){
		CreateShotA(1,GetX-20,GetY-30,10);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,speed,-dir,0,-0.05,0,93);
		SetShotDataA(1,120,0,NULL,-2,0.05,2,94);
		SetShotDataA(1,180,NULL,NULL,0,0.1,2,94);
		FireShot(1);
		dir+=360/12;
		}
		dir+= rand(4,8);
		speed+= -0.3;
		wait(4);
		}
		wait(30);
		PlaySE(CSD ~ "sfx\se_ch02.wav");
		Concentration01(60);
		wait(60);
		
		
		speed=7;
		while(speed>1){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(12){
		CreateShotA(1,GetX-20,GetY-30,10);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,speed,dir,0,-0.05,0,93);
		SetShotDataA(1,120,0,NULL,3,0.05,2,94);
		SetShotDataA(1,180,NULL,NULL,0,0.1,2,94);
		FireShot(1);
		dir+=360/12;
		}
		dir+=rand(4,8);
		speed+= -0.3;
		wait(4);
		}
		wait(90);
		
		speed=7;
		while(speed>1){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(12){
		CreateShotA(1,GetX-20,GetY-30,10);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,speed,-dir,0,-0.05,0,93);
		SetShotDataA(1,120,0,NULL,-3,0.05,2,94);
		SetShotDataA(1,180,NULL,NULL,0,0.1,2,94);
		FireShot(1);
		dir+=360/12;
		}
		dir+= rand(4,8);
		speed+= -0.3;
		wait(4);
		}
		wait(30);
		PlaySE(CSD ~ "sfx\se_ch02.wav");
		Concentration01(60);
		wait(60);
		
		
		speed=7;
		while(speed>1){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(9){
		CreateShotA(1,GetX-20,GetY-30,10);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,speed,dir,0,-0.05,0,93);
		SetShotDataA(1,120,0,NULL,3,0.05,2,94);
		SetShotDataA(1,180,NULL,NULL,0,0.1,2,94);
		FireShot(1);
		
		CreateShotA(1,GetX-20,GetY-30,10);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,speed,-dir,0,-0.05,0,93);
		SetShotDataA(1,120,0,NULL,-3,0.05,2,94);
		SetShotDataA(1,180,NULL,NULL,0,0.1,2,94);
		FireShot(1);
		dir+=360/9;
		}
		dir+= rand(4,8);
		speed+= -0.3;
		wait(4);
		}
		attack=0;
		wait(363);
		
		attack=1;
		loop(4){
		let randx = GetX+rand(-100,100);
		let randy = GetY+rand(-40,20);
		let dir = rand(0,360);
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		loop(60){
		CreateShotA(1,randx,randy,0);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,4,dir,0,0,0,92);
		FireShot(1);
		
		CreateShotA(1,randx,randy,0);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,1.5,dir,0,0,0,92);
		SetShotDataA(1,80,4,dir,0,0,0,92);
		FireShot(1);
		
		CreateShotA(1,randx,randy,0);
		// (id,time,speed,dir,dir-velocity,accel,maxspeed,graphic)
		SetShotDataA(1,0,0.5,dir,0,0,0,92);
		SetShotDataA(1,160,4,dir,0,0,0,92);
		FireShot(1);
		dir+=360/60;
		}		
		wait(20);
		}
		attack=0;
		wait(160);		
		PlaySE(CSD ~ "sfx\se_ch02.wav");
		Concentration01(80);
		wait(80);
		attack=1;
		spell2;
				
		yield;
	}
	
	// spell 2 = 30 seconds
	task spell2{
		//phase 1
		loop(4){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-5,5),95,10);
		wait(15);}
		loop(32){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-5,5),95,10);
		trail(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-2,2),95,0);
		wait(15);}
		PlaySE(CSD ~ "sfx\se_ch02.wav");
		Concentration01(60);
		loop(4){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-5,5),95,10);
		trail(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-2,2),95,0);
		wait(15);}
		
		//phase 2
		loop(6){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-5,5),95,10);
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-10,10),91,10);
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-10,10),91,10);
		trail(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-2,2),95,0);
		wait(10);}
		loop(48){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-5,5),95,10);
		trail(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-2,2),95,0);
		CreateShot01(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-5,5),91,0);
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-10,10),91,10);
		wait(10);}
		PlaySE(CSD ~ "sfx\se_ch02.wav");
		Concentration01(60);
		loop(6){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-5,5),95,10);
		trail(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-2,2),95,0);
		CreateShot01(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-5,5),91,0);
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-10,10),91,10);
		wait(10);}
		
		//phase 3
		let dir = 225;
		loop(18){
		PlaySE(CSD ~ "sfx\se_tan00.wav");
		CreateShot01(GetX-20,GetY-30,4,dir,90,10);
		dir+=5;
		}		
		loop(6){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-5,5),95,10);
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-10,10),91,10);
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-10,10),91,10);
		trail(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-2,2),95,0);
		wait(10);}
		
		loop(8){
		dir = 225;
		loop(18){
		PlaySE(CSD ~ "sfx\se_tan00.wav");
		CreateShot01(GetX-20,GetY-30,4,dir,90,10);
		dir+=5;
		}		
		dir = -220+rand(-20,0);
		loop(45){
		CreateShot01(GetCenterX+dir,GetCenterY-230,4,90,90,0);
		dir+=20;
		}	
		loop(6){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-5,5),95,10);
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-10,10),91,10);
		CreateShot01(GetX-20,GetY-30,5,-90+rand(-10,10),91,10);
		trail(GetCenterX+rand(-200,200),GetCenterY-230,5,90+rand(-2,2),95,0);
		wait(10);}
		}
		attack=0;
		wait(60);
		PlaySE(CSD ~ "sfx\se_ch00.wav");
		wait(60);
		attack=1;
		spell3;
		yield;
	}
	
	task spell3{
		let dir = 0;
		let x = 0;
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		while(x<30){
			laser(GetX-20,GetY-30,4,dir,92,15);
			dir+=360/30;
			x++;}
		dir = 0;
		x = 0;
		wait(120);
		
		loop(48){PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		laser(GetX-20,GetY-30,4,rand(0,360),92,15);
		wait(5);}
		
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		while(x<15){
			explode(GetX-20,GetY-30,4,dir,90,15);
			dir+=360/15;
			x++;}
		
		wait(120);
		
		loop(24){PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		explode(GetX-20,GetY-30,4,rand(0,360),90,15);
		wait(10);}
		
		PlaySE(CSD ~ "sfx\se_ch02.wav");
		wait(60);
		
		loop(45){PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		laser(GetX-20,GetY-30,4,rand(0,360),92,15);
		explode(GetX-20,GetY-30,4,rand(0,360),90,15);
		wait(8);}
		
		attack=0;
		wait(60);
		SetMovePosition02(GetCenterX,GetCenterY-90,90);
		PlaySE(CSD ~ "sfx\se_ch00.wav");		
		wait(89);
		DeleteEnemyShot(ALL);
		wait(1);
		attack=1;
		finalspell1;
		finalspell2;
		yield;
	}
	
	task finalspell1{
		let x = 0;
		let dir = 0;		
		loop(12){
		dir = GetAngleToPlayer + 135 + rand(-20,20);
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		while(x<10){
		reflect1(GetX-20,GetY-30,2,dir,95,10);
		x++;
		dir+=90/10;}
		x=0;
		wait(60);}
		
		loop{
		dir = GetAngleToPlayer + 135 + rand(-20,20);
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		while(x<10){
		reflect1(GetX-20,GetY-30,2,dir,95,10);
		x++;
		dir+=90/10;}
		x=0;
		wait(30);}
	
	yield;
	}
	
	task finalspell2{
		let angle = 0;
		loop(5){
		angle = atan2(GetPlayerY-(GetY-30),GetPlayerX-(GetX-20));
		loop(5){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		reflect2(GetX-20,GetY-30,1,angle,90,10);
		reflect2(GetX-20,GetY-30,1,angle+30,90,10);
		reflect2(GetX-20,GetY-30,1,angle-30,90,10);
		reflect2(GetX-20,GetY-30,1,angle+60,90,10);
		reflect2(GetX-20,GetY-30,1,angle-60,90,10);
		wait(6);}
		wait(150);}
		
		loop{
		angle = atan2(GetPlayerY-(GetY-30),GetPlayerX-(GetX-20));
		loop(5){
		PlaySE(CSD ~ "sfx\se_tan00_2.wav");
		reflect2(GetX-20,GetY-30,1,angle,90,10);
		reflect2(GetX-20,GetY-30,1,angle+30,90,10);
		reflect2(GetX-20,GetY-30,1,angle-30,90,10);
		reflect2(GetX-20,GetY-30,1,angle+60,90,10);
		reflect2(GetX-20,GetY-30,1,angle-60,90,10);
		wait(6);}
		wait(90);}
	
	yield;
	}
	
	task invincible(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,true);
			
			wait(357);
			ObjShot_SetDelay(obj,10);
			wait(3);
			Obj_Delete(obj);
			yield;
	}
	
	task trail(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,true);
						
			while(!Obj_BeDeleted(obj)){
				trail2(Obj_GetX(obj),Obj_GetY(obj),0.1,rand(0,360),49,5);
				wait(4);			
			}
			Obj_Delete(obj);
			yield;
	}
	
	task trail2(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,true);
						
			wait(57);
			ObjShot_SetDelay(obj,3);
			wait(3);
			Obj_Delete(obj);
			yield;
	}
	
	task explode(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,true);
						
						
			while(!Obj_BeDeleted(obj)){
			
				if(Obj_GetY(obj) > GetClipMaxY){
					Obj_SetSpeed(obj,0);
					PlaySE(CSD ~ "sfx\se_kira02.wav");
					ObjShot_SetDelay(obj,60);
					wait(60);
					PlaySE(CSD ~ "sfx\se_kira00.wav");
					loop(15){CreateShot02(Obj_GetX(obj),Obj_GetY(obj),rand(0.5,1.5),rand(0,360),0,0.5,51,10);}
					Obj_Delete(obj);
				}
				
				if(Obj_GetY(obj) < GetClipMinY){
					Obj_SetSpeed(obj,0);
					PlaySE(CSD ~ "sfx\se_kira02.wav");
					ObjShot_SetDelay(obj,60);
					wait(60);
					PlaySE(CSD ~ "sfx\se_kira00.wav");
					loop(15){CreateShot02(Obj_GetX(obj),Obj_GetY(obj),rand(0.5,1.5),rand(0,360),0,0.5,51,10);}
					Obj_Delete(obj);
				}
				
				if(Obj_GetX(obj) < GetClipMinX){
					Obj_SetSpeed(obj,0);
					PlaySE(CSD ~ "sfx\se_kira02.wav");
					ObjShot_SetDelay(obj,60);
					wait(60);
					PlaySE(CSD ~ "sfx\se_kira00.wav");
					loop(15){CreateShot02(Obj_GetX(obj),Obj_GetY(obj),rand(0.5,1.5),rand(0,360),0,0.5,51,10);}
					Obj_Delete(obj);
				}
				
				if(Obj_GetX(obj) > GetClipMaxX){
					Obj_SetSpeed(obj,0);
					PlaySE(CSD ~ "sfx\se_kira02.wav");
					ObjShot_SetDelay(obj,60);
					wait(60);
					PlaySE(CSD ~ "sfx\se_kira00.wav");
					loop(15){CreateShot02(Obj_GetX(obj),Obj_GetY(obj),rand(0.5,1.5),rand(0,360),0,0.5,51,10);}
					Obj_Delete(obj);
				}
				
				yield;
			}
	}
	
	task laser(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,true);
						
			while(!Obj_BeDeleted(obj)){
			
				if(Obj_GetY(obj) > GetClipMaxY){
					Obj_SetSpeed(obj,0);					
					ObjShot_SetDelay(obj,60);
					CreateLaserA(1,Obj_GetX(obj),Obj_GetY(obj),1000,10,39,60);
						SetLaserDataA(1,0,dir-180,0,0,0,0);
						SetShotKillTime(1,180);
						FireShot(1);
					wait(60);
					wait(120);
					Obj_Delete(obj);
				}
				
				if(Obj_GetY(obj) < GetClipMinY){
					Obj_SetSpeed(obj,0);
					ObjShot_SetDelay(obj,60);
					CreateLaserA(1,Obj_GetX(obj),Obj_GetY(obj),1000,10,39,60);
						SetLaserDataA(1,0,dir-180,0,0,0,0);
						SetShotKillTime(1,180);
						FireShot(1);
					wait(60);
					wait(120);
					Obj_Delete(obj);
				}
				
				if(Obj_GetX(obj) < GetClipMinX){
					Obj_SetSpeed(obj,0);
					ObjShot_SetDelay(obj,60);
					CreateLaserA(1,Obj_GetX(obj),Obj_GetY(obj),1000,10,39,60);
						SetLaserDataA(1,0,dir-180,0,0,0,0);
						SetShotKillTime(1,180);
						FireShot(1);
					wait(60);
					wait(120);
					Obj_Delete(obj);
				}
				
				if(Obj_GetX(obj) > GetClipMaxX){
					Obj_SetSpeed(obj,0);
					ObjShot_SetDelay(obj,60);
					CreateLaserA(1,Obj_GetX(obj),Obj_GetY(obj),1000,10,39,60);
						SetLaserDataA(1,0,dir-180,0,0,0,0);
						SetShotKillTime(1,180);
						FireShot(1);
					wait(60);
					wait(120);
					Obj_Delete(obj);
				}
				
				yield;
			}
			
	}
	
	task reflect1(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,false);
						
						
			while(!Obj_BeDeleted(obj)){
			
				if(Obj_GetY(obj) < GetClipMinY){
					Obj_SetAngle(obj,-Obj_GetAngle(obj));
				}
				
				if(Obj_GetX(obj) < GetClipMinX){
					Obj_SetAngle(obj,180-Obj_GetAngle(obj));
				}
				
				if(Obj_GetX(obj) > GetClipMaxX){
					Obj_SetAngle(obj,180-Obj_GetAngle(obj));
				}
				
				yield;
			}
	}
	
	task reflect2(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,true);
						
						
			while(!Obj_BeDeleted(obj)){
			
				if(Obj_GetY(obj) > GetClipMaxY){
					Obj_SetAngle(obj,-Obj_GetAngle(obj));
				}
				
				if(Obj_GetY(obj) < GetClipMinY){
					Obj_SetAngle(obj,-Obj_GetAngle(obj));
				}
				
				if(Obj_GetX(obj) < GetClipMinX){
					Obj_SetAngle(obj,180-Obj_GetAngle(obj));
				}
				
				if(Obj_GetX(obj) > GetClipMaxX){
					Obj_SetAngle(obj,180-Obj_GetAngle(obj));
				}
				
				yield;
			}
	}
	
	function wait(w){
		loop(w){yield;}
	}
	
}