////////////////////////////

task ShotBaseAYabu(ang){
	CreatePlayerShotA1(GetPlayerX,GetPlayerY, 40, 270+ang, 200/60*2/8, 1, 1);
}

task ShotBaseBYabu(x,y){
	let obj = CreatePlayerShotA1(x, y, 100, 270, 100/60*2/2, 1, 2);
	let h_obj = FindTarget(obj);
	if(h_obj != -1){ObjMove_SetAngle(obj,atan2(ObjMove_GetY(h_obj) - ObjMove_GetY(obj), ObjMove_GetX(h_obj) - ObjMove_GetX(obj)));}
}

task FlashYabu{
	let x = GetPlayerX;
	let y = GetPlayerY;
	SetPlayerInvincibilityFrame(30);

	ObjSound_Play(soundLoad[6]);

	FlashRin(x,y);

	task FlashRin(xa,ya){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/shot.png");
		ObjSprite2D_SetSourceRect(obj, 95, 380, 206, 491);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetPosition(obj,xa,ya,0);
		Obj_SetRenderPriorityI(obj,44);
		
		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,0);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);
		
		ascent(a in 0..20){
			ObjRender_SetAngleZ(obj,a*30);
			ObjSpell_SetIntersectionCircle(d,xa,ya,110/2);
			yield;
		}

		ascent(a in 0..10){
			ObjRender_SetAngleZ(obj,20*30+a*30);
			ObjRender_SetScaleXYZ(obj,(10-a)/10,(10-a)/10,0);
			ObjSpell_SetIntersectionCircle(d,xa,ya,110/2*(10-a)/10);
			yield;
		}


		Obj_Delete(obj);
		Obj_Delete(d);
		return;
	}

}

task SpellYabu{
	let manage = GetSpellManageObject;
	let dam = 2000/60;
	SetPlayerSpeed(2.5, 2.5); 
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	ObjSound_Play(soundLoad[5]);

	Effect;
	
	SetPlayerSpeed(4.5, 2.5); 
	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);
	Obj_Delete(manage);
	
	function Effect{
		SetPlayerInvincibilityFrame(210);
		DeletDis();
		wait(120);

		CreateRenderTarget("My Render Target");
		RenderToTextureA1("My Render Target", 0,75,true);
		ObjSound_Play(soundLoad[8]);

		descent(a in 0..16){
			ascent(b in 0..16){
				ItemFall(b*40,a*40);
			}
		}


		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		ScreenShakeA1(60, 5);

		loop(60){
			ObjSpell_SetIntersectionCircle(d,320,240,500);
			yield;
		}
		ClearInvalidRenderPriority;
		Obj_Delete(d);
	}

	task DeletDis(){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/invcircle.png");
		ObjSprite2D_SetSourceRect(obj, 0,0,256,256);
		ObjSprite2D_SetDestCenter(obj);
		Obj_SetRenderPriorityI(obj,76);
		ascent(a in 0..30){
			ObjRender_SetScaleXYZ(obj,a/30*8,a/30*8,0);
			ObjRender_SetAlpha(obj,a/40*255);
			ObjRender_SetPosition(obj,GetPlayerX,GetPlayerY,0);
			yield;
		}
		wait(90);
		descent(a in 0..15){
			ObjRender_SetAlpha(obj,a*255/15);
			yield;
		}
		Obj_Delete(obj);
	}

	task ItemFall(let x,let y){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, "My Render Target");
		ObjSprite2D_SetSourceRect(obj, x,y,x+40,y+40);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetPosition(obj,x+20,y+20,0);
		Obj_SetRenderPriorityI(obj,75);
		let rax = rand(-1,1);
		let ray = rand(-1,1);
		let raz = rand(-1,1);
		let rx = rand(-2,2);
		let ry = rand(1,2);
		let t = 0;
		while(y < 700){
			ObjRender_SetAngleXYZ(obj,rax*t,ray*t,raz*t);
			ObjRender_SetPosition(obj,x+rx*t,y,0);

			y+=t/10*ry;
			t++;
			yield
		}
		Obj_Delete(obj);
	}
}

task ShotBaseATsb(){
	CreatePlayerShotA1(GetPlayerX,GetPlayerY, 40, 270, 120/60*4, 1, 3);
}

task ShotBaseBTsb(x,y){
	CreatePlayerShotA1(x,y, 40, 270, 220/60*2/6, 1, 4);
}

task FlashTsob{
	let x = GetPlayerX;
	let y = GetPlayerY;
	SetPlayerInvincibilityFrame(30);

	ObjSound_Play(soundLoad[6]);

	FlashLaser(x,y,-90);
	FlashLaser(x,y,0);

	task FlashLaser(xa,ya,ang){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/shot.png");
		ObjSprite2D_SetSourceRect(obj, 353, 0, 387, 1024);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetAngleZ(obj,ang);
		ObjRender_SetPosition(obj,xa,ya,0);
		Obj_SetRenderPriorityI(obj,44);
		
		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,0);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);
		
		ascent(a in 1..8){
			ObjRender_SetScaleX(obj,1.5*a/7);
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18*1.5*a/7);
			yield;
		}

		loop(10){
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18*1.5);
			yield;
		}

		descent(a in 1..8){
			ObjRender_SetScaleX(obj,1.5*a/7);
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18*1.5*a/7);
			yield;
		}
		
		Obj_Delete(obj);
		Obj_Delete(d);
		return;
	}

}

task SpellTsob{
	let manage = GetSpellManageObject;
	let dam = 4000/60/15;
	SetPlayerSpeed(2.5, 2.5); 
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	ObjSound_Play(soundLoad[5]);

	Effect;
	
	SetPlayerSpeed(4.5, 2.5); 
	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);
	Obj_Delete(manage);
	
	function Effect{
		SetPlayerInvincibilityFrame(180);
		InversingCharge(255,0);
		wait(30);
		InversingCharge(0,-1);
		wait(60);
		ScreenShakeA1(60, 5);
		ObjSound_Play(soundLoad[8]);
		loop(60){
			loop(3){
				WhiteLasor(12);
				WhiteLasor(0);
			}
			yield;
		}
	}
	task WhiteLasor(z){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/shot.png");
		ObjSprite2D_SetSourceRect(obj, 25+z, 411, 37+z, 494);
		ObjSprite2D_SetDestCenter(obj);
		Obj_SetRenderPriorityI(obj,44);
		
		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		let r = rand(10,25);
		let ang = rand(0,360);
		let x = GetPlayerX;
		let y = GetPlayerY-40;

		while(y > -30){

			ObjRender_SetPosition(obj,x+r*cos(ang),y+r*sin(ang),0);
			ObjSpell_SetIntersectionLine(d,x,y-83/2,x,y+83/2,6);

			y-=50;
			yield;
		}
		Obj_Delete(obj);
		Obj_Delete(d);
	}
	task InversingCharge(z,pri){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/invcircle.png");
		ObjSprite2D_SetSourceRect(obj, 0,0,256,256);
		ObjSprite2D_SetDestCenter(obj);
		Obj_SetRenderPriorityI(obj,44+pri);
		ObjRender_SetColor(obj,z,z,z);
		descent(a in 0..60){
			ObjRender_SetScaleXYZ(obj,a/60*6,a/60*6,0);
			ObjRender_SetAlpha(obj,min(255,(60-a)/6*255));
			ObjRender_SetPosition(obj,GetPlayerX,GetPlayerY,0);
			yield;
		}
		Obj_Delete(obj);
	}
}

////////////////////////////

task ShotBaseAOrochin(){
	CreatePlayerShotA1( GetPlayerX, GetPlayerY, 40, 270, 320/30, 1, 5);
}

task FlashOrochin{
	let x = GetPlayerX;
	let y = GetPlayerY;
	SetPlayerInvincibilityFrame(30);

	ObjSound_Play(soundLoad[6]);

	FlashLaser(x,y-50,-45);
	FlashLaser(x,y-50,45);

	task FlashLaser(xa,ya,ang){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/shot.png");
		ObjSprite2D_SetSourceRect(obj, 353, 0, 387, 1024);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetAngleZ(obj,ang);
		ObjRender_SetPosition(obj,xa,ya,0);
		Obj_SetRenderPriorityI(obj,44);
		
		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,0);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);
		
		ascent(a in 1..8){
			ObjRender_SetScaleX(obj,1.5*a/7);
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18*1.5*a/7);
			yield;
		}

		loop(10){
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18*1.5);
			yield;
		}

		descent(a in 1..8){
			ObjRender_SetScaleX(obj,1.5*a/7);
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18*1.5*a/7);
			yield;
		}
		
		Obj_Delete(obj);
		Obj_Delete(d);
		return;
	}

}

task SpellOrochin{
	let manage = GetSpellManageObject;
	let dam = 3000/70/25;
	SetPlayerSpeed(2.5, 2.5); 
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	ObjSound_Play(soundLoad[5]);

	Effect;
	
	SetPlayerSpeed(4.5, 2.5); 
	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);
	Obj_Delete(manage);
	
	function Effect{
		SetPlayerInvincibilityFrame(180);
		StartLasor(GetPlayerX,GetPlayerY,-30-90);
		ScreenShakeA1(10+15, 5);
		wait(10+15);
		ScreenShakeA1(18+70+25, 10);
		wait(15);
		ascent(a in 0..70){
			Lasor(GetPlayerX,GetPlayerY,-30-90+a*(360+90)/70);
			if(a%15 == 0){ObjSound_Play(soundLoad[2]);}
			yield;
		}
		FinishLasor(GetPlayerX,GetPlayerY,-30);
	}

	task StartLasor(x,y,ang){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/b038.png");
		ObjSprite2D_SetSourceRect(obj, 0, 0, 238, 640);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetAngleZ(obj,ang);
		ObjRender_SetPosition(obj,x+320*cos(ang-90),y+320*sin(ang-90),0);
		Obj_SetRenderPriority(obj,0.44);
		ObjRender_SetScaleY(obj,1.5);

		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);
		ascent(a in 1..11){
			ObjRender_SetScaleX(obj,2/20*a/10);
			ObjRender_SetPosition(obj,GetPlayerX+320*1.5*cos(ang-90),GetPlayerY+320*1.5*sin(ang-90),0);
			ObjSpell_SetIntersectionLine(d,GetPlayerX,GetPlayerY,GetPlayerX+640*1.5*cos(ang-90),GetPlayerY+640*1.5*sin(ang-90),238/2*a/10*2/20);
			yield;
		}
		loop(15){
			ObjRender_SetPosition(obj,GetPlayerX+320*1.5*cos(ang-90),GetPlayerY+320*1.5*sin(ang-90),0);
			ObjSpell_SetIntersectionLine(d,GetPlayerX,GetPlayerY,GetPlayerX+640*1.5*cos(ang-90),GetPlayerY+640*1.5*sin(ang-90),238/2/10);
			yield;
		}
		ObjSound_Play(soundLoad[2]);
		ascent(a in 3..21){
			ObjRender_SetScaleX(obj,a/20);
			ObjRender_SetPosition(obj,GetPlayerX+320*1.5*cos(ang-90),GetPlayerY+320*1.5*sin(ang-90),0);
			ObjSpell_SetIntersectionLine(d,GetPlayerX,GetPlayerY,GetPlayerX+640*1.5*cos(ang-90),GetPlayerY+640*1.5*sin(ang-90),238/2*a/20);
			yield;
		}
		loop(25){
			ObjRender_SetPosition(obj,GetPlayerX+320*1.5*cos(ang-90),GetPlayerY+320*1.5*sin(ang-90),0);
			ObjSpell_SetIntersectionLine(d,GetPlayerX,GetPlayerY,GetPlayerX+640*1.5*cos(ang-90),GetPlayerY+640*1.5*sin(ang-90),238/2);
			yield;
		}

		Obj_Delete(obj);
		Obj_Delete(d);
	}
	task Lasor(x,y,ang){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/b038.png");
		ObjSprite2D_SetSourceRect(obj, 0, 0, 238, 640);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetAngleZ(obj,ang);
		ObjRender_SetPosition(obj,x+320*cos(ang-90),y+320*sin(ang-90),0);
		Obj_SetRenderPriority(obj,0.44);
		ObjRender_SetScaleY(obj,1.5);

		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		loop(25){
			ObjRender_SetPosition(obj,GetPlayerX+320*1.5*cos(ang-90),GetPlayerY+320*1.5*sin(ang-90),0);
			ObjSpell_SetIntersectionLine(d,GetPlayerX,GetPlayerY,GetPlayerX+640*1.5*cos(ang-90),GetPlayerY+640*1.5*sin(ang-90),238/2);
			yield;
		}
		
		Obj_Delete(obj);
		Obj_Delete(d);
	}
	task FinishLasor(x,y,ang){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/b038.png");
		ObjSprite2D_SetSourceRect(obj, 0, 0, 238, 640);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetAngleZ(obj,ang);
		Obj_SetRenderPriority(obj,0.44);	
		ObjRender_SetScaleY(obj,1.5);

		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		loop(25){
			ObjRender_SetPosition(obj,GetPlayerX+320*1.5*cos(ang-90),GetPlayerY+320*1.5*sin(ang-90),0);
			ObjSpell_SetIntersectionLine(d,GetPlayerX,GetPlayerY,GetPlayerX+640*1.5*cos(ang-90),GetPlayerY+640*1.5*sin(ang-90),238/2);
			yield;
		}

		descent(a in 0..31){
			ObjRender_SetScaleX(obj,a/30);
			ObjRender_SetPosition(obj,GetPlayerX+320*1.5*cos(ang-90),GetPlayerY+320*1.5*sin(ang-90),0);
			yield;
		}

		Obj_Delete(d);
		Obj_Delete(obj);
	}
}

task ShotBaseASukune(x,y,ang){
	CreatePlayerShotA1( x, y, 50, 270+ang, 320/3/60, 1, 6);
}

task FlashSukune{
	let x = GetPlayerX;
	let y = GetPlayerY;
	SetPlayerInvincibilityFrame(30);

	ObjSound_Play(soundLoad[6]);

	FlashArea(x,y,128*1.2);
	FlashArea(x,y,128*2);

	loop(30){
		let list = GetShotIdInCircleA2(x,y,128*2*0.9,TARGET_ENEMY);
		ascent(a in 0..length(list)){
			if(GetDis(ObjMove_GetX(list[a]),ObjMove_GetY(list[a]),x,y) > 128*1.2*0.9){
				if(!ObjShot_IsSpellResist(list[a])){ObjShot_SetDeleteFrame(list[a],0);}
			}
		}
		yield;
	}

	function GetDis(x1,y1,x2,y2){return((|((x2-x1)^2+(y2-y1)^2)^(1/2)|));}

	task FlashArea(xa,ya,ang){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/invcircle.png");
		ObjRender_SetBlendType(obj, BLEND_INV_DESTRGB);
		ObjSprite2D_SetSourceRect(obj, 0, 0, 256, 256);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetAngleZ(obj,ang);
		ObjRender_SetPosition(obj,xa,ya,0);
		Obj_SetRenderPriorityI(obj,65);
		ObjRender_SetScaleXYZ(obj,ang/128,ang/128,0);
		
		wait(30);
		
		Obj_Delete(obj);
	}
}

task SpellSukune{
	let manage = GetSpellManageObject;
	let dam = 900/110;
	SetPlayerSpeed(2.5, 2.5); 
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	ObjSound_Play(soundLoad[5]);

	Effect;
	
	SetPlayerSpeed(4.5, 2.5); 
	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);
	Obj_Delete(manage);
	
	function Effect{
		SetPlayerInvincibilityFrame(180);
		let x = GetPlayerX;
		let y = GetPlayerY;
		let ansg = rand(0,360);
		ascent(a in 0..8){
			Bombsu(x,y,a*360/8+ansg);
		}
		wait(60);
		ObjSound_Play(soundLoad[6]);
		ScreenShakeA1(120, 5);
		wait(120);
	}
	task Bombsu(x,y,ang){
		let obj = ObjPrim_Create(OBJ_SPRITE_LIST_2D);
		Obj_SetRenderPriority(obj, 0.44);
		ObjPrim_SetTexture(obj, CSD ~ "img/b049.png");

		let r = 0;

		loop(60){
			ObjSpriteList2D_ClearVertexCount(obj);
			
			ObjSpriteList2D_SetSourceRect(obj,0,0,20,20);
			ObjSpriteList2D_SetDestRect(obj,x-(10+3*cos(r*360*6/60))+r*3*cos(ang+r*2),y-(10+3*cos(r*360*6/60))+r*3*sin(ang+r*2),x+(10+3*cos(r*360*6/60))+r*3*cos(ang+r*2),y+(10+3*cos(r*360*6/60))+r*3*sin(ang+r*2));
			ObjSpriteList2D_AddVertex(obj);

			r++;

			yield;
		}
		
		let x2 = x+r*3*cos(ang+r*2);
		let y2 = y+r*3*sin(ang+r*2);

		let t = 0;
		let sc = 1/9;

		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		ObjPrim_SetTexture(obj, CSD ~ "img/b69.png");

		loop(8){
			ObjSpriteList2D_ClearVertexCount(obj);

			ObjSpriteList2D_SetSourceRect(obj,0,0,250,250);
			ObjSpriteList2D_SetDestRect(obj,x2-125*sc,y2-125*sc,x2+125*sc,y2+125*sc);
			ObjSpriteList2D_AddVertex(obj);

			ObjSpriteList2D_SetSourceRect(obj,250,0,500,250);
			ObjSpriteList2D_SetDestRect(obj,x2-125*sc,y2-125*sc,x2+125*sc,y2+125*sc);
			ObjSpriteList2D_AddVertex(obj);

			sc = min(sc+1/9,1);

			yield;
		}

		let obj2 = ObjPrim_Create(OBJ_SPRITE_2D);
		Obj_SetRenderPriority(obj2, 0.43);
		ObjPrim_SetTexture(obj2, CSD ~ "img/b69.png");
		ObjSprite2D_SetSourceRect(obj2, 0, 250, 250, 500);
		ObjSprite2D_SetDestCenter(obj2);
		ObjRender_SetPosition(obj2,x2,y2,0);

		loop(112){
			ObjSpriteList2D_ClearVertexCount(obj);

			ObjSpriteList2D_SetSourceRect(obj,0,0,250,250);
			ObjSpriteList2D_SetDestRect(obj,x2-(125+10*cos(t*3)),y2-(125+10*cos(t*3)),x2+(125+10*cos(t*3)),y2+(125+10*cos(t*3)));
			ObjSpriteList2D_AddVertex(obj);

			ObjSpriteList2D_SetSourceRect(obj,250,0,500,250);
			ObjSpriteList2D_SetDestRect(obj,x2-(125+10*cos(t*3)),y2-(125+10*cos(t*3)),x2+(125+10*cos(t*3)),y2+(125+10*cos(t*3)));
			ObjSpriteList2D_AddVertex(obj);

			ObjRender_SetScaleXYZ(obj2,(125+10*cos(t*3))/125,(125+10*cos(t*3))/125,0);
			ObjRender_SetAngleZ(obj2,t*4);

			ObjSpell_SetIntersectionCircle(d,x2,y2,110+10*cos(t*3));

			t++;

			yield;
		}

		Obj_Delete(obj2);

		loop(8){
			ObjSpriteList2D_ClearVertexCount(obj);

			ObjSpriteList2D_SetSourceRect(obj,0,0,250,250);
			ObjSpriteList2D_SetDestRect(obj,x2-125*sc,y2-125*sc,x2+125*sc,y2+125*sc);
			ObjSpriteList2D_AddVertex(obj);

			ObjSpriteList2D_SetSourceRect(obj,250,0,500,250);
			ObjSpriteList2D_SetDestRect(obj,x2-125*sc,y2-125*sc,x2+125*sc,y2+125*sc);
			ObjSpriteList2D_AddVertex(obj);

			sc = max(sc-1/9,0);

			yield;
		}

		Obj_Delete(obj);
		Obj_Delete(d);
	}
}

////////////////////////////

task ShotBaseATenkat(ang){
	let obj = CreatePlayerShotA1(GetPlayerX,GetPlayerY, 15, 270+ang, 120/60*3/3, 1, 11);
	let h_obj = FindTarget(obj);
	if(h_obj != -1){
		Homing(obj,h_obj,5);
	}
	let sc = rand(0.5,0.75);
	let an = rand(0,360);
	ObjRender_SetScaleXYZ(obj,sc,sc,0);
	while(!Obj_IsDeleted(obj)){
		ObjRender_SetAngleZ(obj,an);
		an+=12;
		yield;
	}
}

task ShotBaseBTenkat(x,y,ang,del){
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriority(obj, 0.40);
	ObjPrim_SetTexture(obj, CSD ~ "img/blasor.png");
	ObjSprite2D_SetSourceRect(obj, 0,del*3,12,1024+del*3);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj,x+512*cos(ang-90),y+512*sin(ang-90),0);
	ObjRender_SetAngleZ(obj,ang);

	let d = ObjSpell_Create;
	ObjSpell_SetDamage(d,160/4/60);
	ObjSpell_SetEraseShot(d,false);
	ObjSpell_Regist(d);
	ObjSpell_SetIntersectionLine(d,x,y,x+1024*cos(ang-90),y+1024*sin(ang-90),9);

	yield;

	Obj_Delete(obj);
	Obj_Delete(d);
}

task FlashTenkat{
	let x = GetPlayerX;
	let y = GetPlayerY;
	let rax = rand(-1,1);
	let ray = rand(-1,1);
	let raz = rand(-1,1);
	SetPlayerInvincibilityFrame(30);

	ObjSound_Play(soundLoad[6]);

	FlashRin(x,y,0);
	FlashRin(x,y,90);

	let d = ObjSpell_Create;
	ObjSpell_SetDamage(d,0);
	ObjSpell_SetEraseShot(d,true);
	ObjSpell_Regist(d);
	let counta = 0;

	while(y > -30){
		ObjSpell_SetIntersectionLine(d,x-128*counta/80,y,x+128*counta/80,y,64*counta/80);
		y-=counta/6;
		counta++;
		yield;
	}
	Obj_Delete(d);

	task FlashRin(xa,let ya,angz){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/b001.png");
		ObjSprite2D_SetSourceRect(obj, 0,0,128/4*3,256);
		ObjSprite2D_SetDestCenter(obj);
		Obj_SetRenderPriorityI(obj,44);
		ObjRender_SetBlendType(obj,BLEND_INV_DESTRGB);

		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,0);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		let count = 0;
		let sc = 0;

		while(y > -30){
			ObjRender_SetPosition(obj,xa,ya,0);
			ObjRender_SetScaleXYZ(obj,sc,sc,0);
			ObjRender_SetAngleXYZ(obj,60+rax*count/2,ray*count/2,raz*count/2+angz);

			sc = count/80;
			ya-= count/6;
			count++;
			yield;
		}
		Obj_Delete(obj);
	}

}

task SpellTenkat{
	let manage = GetSpellManageObject;
	let dam = 5000/400;
	
	let uobj = CSD ~ "img/b062.png";

	SetPlayerSpeed(2.5, 2.5); 
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	ObjSound_Play(soundLoad[5]);

	Effect;
	
	SetPlayerSpeed(4.5, 2.5); 
	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);
	Obj_Delete(manage);
	
	function Effect{
		SetPlayerInvincibilityFrame(310);
		ScreenShakeA1(50*5+40, 5);
		ascent(a in 0..50){
			PUSH((a*64)%480);
			PUSH2((a*64)%480);
			PUSH((a*64+240)%480);
			PUSH2((a*64+240)%480);
			ObjSound_Play(soundLoad[8]);
			wait(5);
		}
		ObjSound_Play(soundLoad[8]);
		ascent(a in 0..8){
			FPUSH((a*64));
			FPUSH2((a*64));
		}
		wait(50);
	}

	task PUSH(y){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj,uobj);
		ObjSprite2D_SetSourceRect(obj,0,y,256,y+64);
		Obj_SetRenderPriorityI(obj,40);

		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		ascent(a in 1..6){
			ObjSprite2D_SetDestRect(obj, 0,y-32,a/5*GetStgFrameWidth/2,y+32);
			ObjSpell_SetIntersectionLine(d,0,y,a/5*GetStgFrameWidth/2,y,32);
			yield;
		}
		descent(a in 1..6){
			ObjSprite2D_SetDestRect(obj, 0,y-32,a/5*GetStgFrameWidth/2,y+32);
			ObjSpell_SetIntersectionLine(d,0,y,a/5*GetStgFrameWidth/2,y,32);
			yield;
		}	
		Obj_Delete(obj);
	}
	task PUSH2(y){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj,uobj);
		ObjSprite2D_SetSourceRect(obj,0,y,256,y+64);
		Obj_SetRenderPriorityI(obj,40);


		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		ascent(a in 1..6){
			ObjSprite2D_SetDestRect(obj, GetStgFrameWidth,y-32,GetStgFrameWidth-a/5*GetStgFrameWidth/2,y+32);
			ObjSpell_SetIntersectionLine(d,GetStgFrameWidth,y,GetStgFrameWidth-a/5*GetStgFrameWidth/2,y,32);
			yield;
		}
		descent(a in 1..6){
			ObjSprite2D_SetDestRect(obj, GetStgFrameWidth,y-32,GetStgFrameWidth-a/5*GetStgFrameWidth/2,y+32);
			ObjSpell_SetIntersectionLine(d,GetStgFrameWidth,y,GetStgFrameWidth-a/5*GetStgFrameWidth/2,y,32);
			yield;
		}	
		Obj_Delete(obj);
	}

	task FPUSH(y){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj,uobj);
		ObjSprite2D_SetSourceRect(obj,0,y,256,y+64);
		Obj_SetRenderPriorityI(obj,40);


		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam/2);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		ascent(a in 1..6){
			ObjSprite2D_SetDestRect(obj, 0,y-32,a/5*GetStgFrameWidth/2,y+32);
			ObjSpell_SetIntersectionLine(d,0,y,a/5*GetStgFrameWidth/2,y,32);
			yield;
		}		
		loop(30){
			ObjSpell_SetIntersectionLine(d,0,y,GetStgFrameWidth/2,y,32);
			yield;
		}
		descent(a in 1..6){
			ObjSprite2D_SetDestRect(obj, 0,y-32,a/5*GetStgFrameWidth/2,y+32);
			ObjSpell_SetIntersectionLine(d,0,y,a/5*GetStgFrameWidth/2,y,32);
			yield;
		}	
		Obj_Delete(obj);
	}
	task FPUSH2(y){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj,uobj);
		ObjSprite2D_SetSourceRect(obj,0,y,256,y+64);
		Obj_SetRenderPriorityI(obj,40);


		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,dam/2.5);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		ascent(a in 1..6){
			ObjSprite2D_SetDestRect(obj, GetStgFrameWidth,y-32,GetStgFrameWidth-a/5*GetStgFrameWidth/2,y+32);
			ObjSpell_SetIntersectionLine(d,GetStgFrameWidth,y,GetStgFrameWidth-a/5*GetStgFrameWidth/2,y,32);
			yield;
		}
		loop(30){
			ObjSpell_SetIntersectionLine(d,GetStgFrameWidth,y,320,y,32);
			yield;
		}
		descent(a in 1..6){
			ObjSprite2D_SetDestRect(obj, GetStgFrameWidth,y-32,GetStgFrameWidth-a/5*GetStgFrameWidth/2,y+32);
			ObjSpell_SetIntersectionLine(d,GetStgFrameWidth,y,GetStgFrameWidth-a/5*GetStgFrameWidth/2,y,32);
			yield;
		}
		Obj_Delete(obj);
	}
}

task ShotBaseABambi(){
	CreatePlayerShotA1(GetPlayerX+8,GetPlayerY+8, 40, 270, 120/60, 1, 8);
	CreatePlayerShotA1(GetPlayerX-8,GetPlayerY+8, 40, 270, 120/60, 1, 8);
}

task ShotBaseBBambi(ang){
	let obj = CreatePlayerShotA1(GetPlayerX,GetPlayerY, 20, ang, 0, 10000, 9);
	while(!Obj_IsDeleted(obj)){
		CreatePlayerShotA1(ObjMove_GetX(obj),ObjMove_GetY(obj), 10, rand(0,360), 4/5*3, 1, 10);
		CreatePlayerShotA1(ObjMove_GetX(obj),ObjMove_GetY(obj), 10, rand(0,360), 4/5*3, 1, 10);
		wait(3);
	}
	function GetAngA2(obj){return atan2(GetPlayerY-GetY(obj),GetPlayerX-GetX(obj));}
	function GetX(id){return ObjMove_GetX(id);}
	function GetY(id){return ObjMove_GetY(id);}
}

task ShotBaseCBambi(){
	let obj = CreatePlayerShotA1(GetPlayerX,GetPlayerY-16, 20, -90, 0, 10000, 9);
	let h_obj = FindTarget(obj);
	let ranang = rand(-20,-8)*[-1,1][floor(rand(0,1.9999999))];
	let dir = -ranang/absolute(ranang);
	if(h_obj != -1){ObjMove_SetAngle(obj,atan2(ObjMove_GetY(h_obj) - ObjMove_GetY(obj), ObjMove_GetX(h_obj) - ObjMove_GetX(obj))+ranang);}
	while(!Obj_IsDeleted(obj)){
		loop(2){CreatePlayerShotA1(ObjMove_GetX(obj),ObjMove_GetY(obj), 10, ObjMove_GetAngle(obj)+rand(-80,80), 3, 1, 10);}
		yield;
	}
}

task FlashBambi{
	SetPlayerInvincibilityFrame(30);

	ObjSound_Play(soundLoad[6]);

	ascent(a in -2..3){
		FlashLaser(GetStgFrameWidth/2+a*(GetStgFrameWidth/3),GetStgFrameHeight/2,45,false);
		FlashLaser(GetStgFrameWidth/2+(-a)*(GetStgFrameWidth/3),GetStgFrameHeight/2,-45,true);
		wait(1);
	}

	task FlashLaser(xa,ya,ang,inv){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/shot.png");
		ObjSprite2D_SetSourceRect(obj, 353, 0, 387, 1024);
		ObjSprite2D_SetDestCenter(obj);
		ObjRender_SetAngleZ(obj,ang);
		ObjRender_SetPosition(obj,xa,ya,0);
		Obj_SetRenderPriorityI(obj,44);
		if(inv){ObjSprite2D_SetSourceRect(obj, 480, 0, 509, 1024);}
		
		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,0);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);
		
		ascent(a in 1..8){
			ObjRender_SetScaleX(obj,a/7);
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18*a/7);
			yield;
		}

		loop(7){
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18);
			yield;
		}

		descent(a in 1..8){
			ObjRender_SetScaleX(obj,a/7);
			ObjSpell_SetIntersectionLine(d,xa-512*cos(-90+ang),ya-512*sin(-90+ang),xa+512*cos(-90+ang),ya+512*sin(-90+ang),18*a/7);
			yield;
		}
		
		Obj_Delete(obj);
		Obj_Delete(d);
		return;
	}
}

task SpellBambi{
	let manage = GetSpellManageObject;
	let dam = 4000/60/15;
	SetPlayerSpeed(2.5, 2.5); 
	SetForbidPlayerSpell(true);
	ObjSound_Play(soundLoad[5]);
	let uniang = -90;

	Effect;
	
	SetPlayerSpeed(4.5, 2.5); 
	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);
	Obj_Delete(manage);
	
	function Effect{
		SetPlayerInvincibilityFrame(180);
		loop(30){
			loop(4){
				WhiteLasor(12);
			}
			yield;
		}
		loop(120/5){
			loop(5){
				loop(4){
					WhiteLasor(12);
				}
				loop(30){
					let ran = rand(20,500);
					let obja =CreatePlayerShotA1(GetPlayerX+ran*cos(uniang), GetPlayerY+ran*sin(uniang), 0, uniang-40, 3, 1, 10);
					ObjMove_AddPatternA2(obja,30,0,NO_CHANGE,10/40,0,30);
				}
				uniang+=360/120;
				yield;
			}
			ObjSound_Play(soundLoad[9]);
		}
	}
	task WhiteLasor(z){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/shot.png");
		ObjSprite2D_SetSourceRect(obj, 25+z, 411, 37+z, 494);
		ObjSprite2D_SetDestCenter(obj);
		Obj_SetRenderPriorityI(obj,44);

		let d = ObjSpell_Create;
		ObjSpell_SetDamage(d,1);
		ObjSpell_SetEraseShot(d,true);
		ObjSpell_Regist(d);

		let r = rand(10,25);
		let r2 = 40;
		let ang = rand(0,360);
		let x = GetPlayerX;
		let y = GetPlayerY;

		while(r2 < 700){

			ObjRender_SetPosition(obj,x+r*cos(ang)+r2*cos(uniang),y+r*sin(ang)+r2*sin(uniang),0);
			ObjRender_SetAngleZ(obj,uniang+90);
			ObjSpell_SetIntersectionLine(d,x+r*cos(ang)+(r2-83/2)*cos(uniang),y+r*sin(ang)+(r2-83/2)*sin(uniang),x+r*cos(ang)+(r2+83/2)*cos(uniang),y+r*sin(ang)+(r2+83/2)*sin(uniang),6);

			r2+=50;
			yield;
		}
		Obj_Delete(obj);
	}
	task InversingCharge(z,pri){
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, CSD ~ "img/invcircle.png");
		ObjSprite2D_SetSourceRect(obj, 0,0,256,256);
		ObjSprite2D_SetDestCenter(obj);
		Obj_SetRenderPriorityI(obj,44+pri);
		ObjRender_SetColor(obj,z,z,z);
		descent(a in 0..60){
			ObjRender_SetScaleXYZ(obj,a/60*6,a/60*6,0);
			ObjRender_SetAlpha(obj,min(255,(60-a)/6*255));
			ObjRender_SetPosition(obj,GetPlayerX,GetPlayerY,0);
			yield;
		}
		Obj_Delete(obj);
	}
}

////////////////////////////////////////


task TExplosionA1(x, y, r){
	let path = CSD ~ "img/charge_wave.png";
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	let dScale = 0;
		
	let xa = [rand(-15,15),180+rand(-15,15)][truncate(rand(0,1.99))];
	let ya = [rand(-15,15),180+rand(-15,15)][truncate(rand(0,1.99))];
		
	ObjPrim_SetTexture(obj, path);
	Obj_SetRenderPriority(obj, 0.65);
	ObjRender_SetBlendType(obj, BLEND_ADD_ARGB);
	ObjSprite2D_SetSourceRect(obj, 0, 0, 128, 128);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetAngleXYZ(obj,xa,ya,0);
	ObjRender_SetPosition(obj,x,y,0);
	ObjRender_SetColorHSV(obj, rand(0,399), 128, 128);

	let scale = 0;
	let alpha = 255;
	while(alpha > 0)
	{
		ObjRender_SetAlpha(obj, alpha);
		ObjRender_SetScaleXYZ(obj, scale, scale, 1);

		scale = r/66*sin(dScale);
		dScale+= 90/20;
		alpha -= 255/20;
		yield;
	}
	Obj_Delete(obj);
}

function FindTarget(obj){
	let enemy_id = GetIntersectionRegistedEnemyID;
	let mindis = 999;
	let h_obj;
	if(length(enemy_id)>0){
	h_obj = enemy_id[0];
	ascent(i in 0..length(enemy_id)){
	let dis = GetDistance(ObjMove_GetX(obj),ObjMove_GetY(obj),ObjMove_GetX(enemy_id[i]),ObjMove_GetY(enemy_id[i]));
		if(mindis>dis){
		mindis = dis;
		h_obj = enemy_id[i];
		}
	}
	return h_obj;
	}
	else
	{
	return -1;
	}
	
	function GetDistance(x1,y1,x2,y2){return((|((x2-x1)^2+(y2-y1)^2)^(1/2)|));}
}

task Homing(obj,h_obj,maxTraverse){
	let angle = ObjMove_GetAngle(obj);
	let dir = 0;
	let boss = GetIntersectionRegistedEnemyID;
    while(! Obj_IsDeleted(obj) && Obj_GetValueD(h_obj,"HomingOrNot",1)==1 && FindTarget(obj)!=-1) {
        ObjMove_SetAngle(obj, angle);
		maxTraverse += 0.5;
		if(length(boss)>=1){
		dir = atan2(ObjMove_GetY(h_obj) - ObjMove_GetY(obj),
                        ObjMove_GetX(h_obj) - ObjMove_GetX(obj));
						if(ObjRender_GetX(h_obj)==0 && ObjRender_GetY(h_obj)==0){
							if(FindTarget(obj)!=-1 && ObjMove_GetX(h_obj) > GetStgFrameWidth+40 && ObjMove_GetX(h_obj) < -40 && ObjMove_GetY(h_obj) > GetStgFrameHeight+40 && ObjMove_GetY(h_obj) < -40)
							{
								h_obj = FindTarget(obj);
							}
							else
							{
								break;
							}
						}
						}
        let diff = dir - angle;
        while(diff >= 180) { diff -= 360; }
        while(diff < -180) { diff += 360; }

        let diffAbs = (|diff|);
        if(diffAbs < maxTraverse) {
            angle = dir;
        } else {
            angle += maxTraverse * diff / diffAbs;
        }
		yield;
    }
}	

	task ScreenShakeA1(shaketime, intensity){//Python?
		let x = Get2DCameraX;
		let y = Get2DCameraY;
		while(shaketime>0){
			Set2DCameraFocusX(GetStgFrameWidth/2 + rand(-intensity, intensity));
			Set2DCameraFocusY(GetStgFrameHeight/2 + rand(-intensity, intensity));
			shaketime--;
			yield;
		}
		Set2DCameraFocusX(GetStgFrameWidth/2);
		Set2DCameraFocusY(GetStgFrameHeight/2);
		yield;
	}

///////////////////////////////////

task hitboxRender{
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriority(obj, 0.54);
	ObjPrim_SetTexture(obj, CSD ~ "img/shot.png");
	ObjSprite2D_SetSourceRect(obj, 406, 6, 469, 69);
	ObjSprite2D_SetDestCenter(obj);
	
	let sc = 0;
	let z = 0;
	hitboxActive = true;
	
	while(GetVirtualKeyState(VK_SLOWMOVE)==KEY_HOLD){
		
		if(sc < 1.4 && GetPlayerState!=STATE_DOWN){
			sc += 0.125;
			z  += 3;
			Pos;
		}else{break;}
		
		yield;
	}
	
	while(GetVirtualKeyState(VK_SLOWMOVE)==KEY_HOLD){
		
		if(sc > 1 && GetPlayerState!=STATE_DOWN){
			sc -= 0.1;
			z  += 3;
			Pos;
		}
		else{break;}
		
		yield;
	}
	
	sc = 1;
	yield;
	
	while(GetVirtualKeyState(VK_SLOWMOVE)==KEY_HOLD){
		
		if(GetPlayerState!=STATE_DOWN){
			z  += 3;
			Pos;
		}else{break;}
		yield;
	}
	
	hitboxActive = false;
	
	while(sc>0){
		sc -= 0.25;
		z  += 3;
		Pos;
		yield;
	}
	
	Obj_Delete(obj);
	
	task Pos{
		ObjRender_SetPosition(obj, GetPlayerX, GetPlayerY, 0);
		ObjRender_SetScaleXYZ(obj, sc, sc, sc);
		ObjRender_SetAngleZ(obj,z);
	}
}

task FlashMeter{
	let obj2 = ObjPrim_Create(OBJ_PRIMITIVE_2D);
	ObjPrim_SetTexture(obj2, CSD ~ "img/b001.png");
	ObjPrim_SetPrimitiveType(obj2, PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(obj2, 64);
	Obj_SetRenderPriority(obj2, 0.52);

	ObjPrim_SetVertexUVT(obj2, 0, 0, 0);
	ObjPrim_SetVertexUVT(obj2, 1, 0, 4);	
	ObjPrim_SetVertexUVT(obj2, 62, 31*8, 0);
	ObjPrim_SetVertexUVT(obj2, 63, 31*8+4, 4);		

	ascent(a in 1..31){
		ObjPrim_SetVertexUVT(obj2, a*2, a*8, 0);
		ObjPrim_SetVertexUVT(obj2, a*2 + 1, a*8+4, 4);		
	}

	let t = 0;
	let grazusi = GetGraze;
	let flashAc = false;

	while(true){
		grazusi = GetGraze;

		let flash2 = flash/50;
		ascent(a in 0..32){
			if(a < 31 && a > 0){
				ObjPrim_SetVertexPosition(obj2, a*2, GetPlayerX+32*cos((a*360/32)*flash2), GetPlayerY+32*sin((a*360/32)*flash2), 0);
				ObjPrim_SetVertexPosition(obj2, a*2+1, GetPlayerX+36*cos((a*360/32+360/64)*flash2), GetPlayerY+36*sin((a*360/32+360/64)*flash2), 0);
			}
			if(a == 0){
				ObjPrim_SetVertexPosition(obj2, 0, GetPlayerX+32*cos(0), GetPlayerY+32*sin(0), 0);
				ObjPrim_SetVertexPosition(obj2, 1, GetPlayerX+36*cos(0), GetPlayerY+36*sin(0), 0);
			}
			if(a == 31){
				ObjPrim_SetVertexPosition(obj2, 62, GetPlayerX+32*cos(360*flash2), GetPlayerY+32*sin(360*flash2), 0);
				ObjPrim_SetVertexPosition(obj2, 63, GetPlayerX+36*cos(360*flash2), GetPlayerY+36*sin(360*flash2), 0);
			}
		}

		t++;

		yield;

		flash = min(50,flash+(GetGraze-grazusi));

		if(flash == 50){
			ObjRender_SetColor(obj2,255,100+55*cos(t*3),100+55*cos(t*3));
			if(!flashAc){flashAc = true;ObjSound_Play(soundLoad[7]);}
		}
		else{
			flashAc = false;
			ObjRender_SetColor(obj2,255,255,255);
		}
	}
}

task Spawn{
	ObjMove_SetPosition(playerID,playerPosDeath[0],playerPosDeath[1]);
	SetPlayerInvincibilityFrame(120);
	SetForbidPlayerSpell(true);
	wait(120);
	SetForbidPlayerSpell(false);
}