//メイン＆サブショット
task TShot
{//メイン
	let pShot=false;
	ShotCheck;
	let Speed=22.5;
	let MainDamage=3.0;
//	let DamageRate=1;
	loop
	{
		while(!pShot){yield;}
//		if(IsPlayerSpellActive){DamageRate=2.0;}
//		else{DamageRate=1.0;}

		if(OnSpell){
			MainDamage = 3.2;
		}else{
			MainDamage = 3.0;
		}
		MainShot(GetPlayerX()+8, GetPlayerY(), Speed, 270, MainDamage, 1, 30);
		MainShot(GetPlayerX()-8, GetPlayerY(), Speed, 270, MainDamage, 1, 30);
//		PlaySE(SE_SHOT);

		loop(3){yield;}
	}

	task ShotCheck
	{
		loop
		{
			if((GetVirtualKeyState(VK_SHOT)==KEY_PUSH || GetVirtualKeyState(VK_SHOT)==KEY_HOLD) && GetPlayerState==STATE_NORMAL && IsPermitPlayerShot)
			{
				pShot=true;
			}
			else
			{
				pShot=false;
			}
			yield;
		}
	}

	task MainShot(x,y,speed,angle,damage,pene,id)
	{
		let obj=CreatePlayerShotA1(x,y,speed,angle,damage,pene,id);
		let scale=1;
		ObjRender_SetScaleXYZ(obj,scale,scale,scale);
		Obj_SetRenderPriorityI(obj,40);
		let OldX;
		let OldY;
		while(!Obj_IsDeleted(obj))
		{
			OldX=ObjMove_GetX(obj);
			OldY=ObjMove_GetY(obj);
			yield;
		}
		HitEffect(OldX,OldY,speed,angle);
		HitEffect2(OldX,OldY,speed,angle);
		Obj_Delete(obj);
	}

	task HitEffect(x,y,speed,angle)
	{
		let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
		ObjPrim_SetTexture(obj,IMG_SHOT);
		ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjPrim_SetVertexCount(obj, 4);
		ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
		Obj_SetRenderPriorityI(obj,40);
		ObjRender_SetAngleZ(obj,angle+90);

		ObjPrim_SetDestCenter(obj,128,96,144,128);

		ObjRender_SetPosition(obj,x+1,y-18,0);
		speed/=8;
		let Alpha=1.0;
		let R=255;
		let G=255;
		let B=255;
		loop(3)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=1.0/9;
			yield;
		}
		ObjPrim_SetDestCenter(obj,128,64,144,96);
		loop(3)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=1.0/9;
			yield;
		}
		ObjPrim_SetDestCenter(obj,128,32,144,64);
		loop(3)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=1.0/9;
			yield;
		}
		Obj_Delete(obj);
	}

	task HitEffect2(x,y,speed,angle)
	{
		angle+=180+rand(-90,90);
		let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
		ObjPrim_SetTexture(obj,IMG_SHOT);
		ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjPrim_SetVertexCount(obj, 4);
		ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
		Obj_SetRenderPriorityI(obj,40);

		ObjPrim_SetDestCenter(obj,128,96,144,128);

		ObjRender_SetPosition(obj,x,y,0);
		speed=rand(2.5,5);
		let Scale=1;
		let Alpha=0.5;
		let R=255;
		let G=255;
		let B=255;
		let Zangle=angle+90;
		let ZanglePlus=rand(10,20)*rand_dir;
		loop(10)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=0.5/15;
			ObjRender_SetAngleZ(obj,Zangle);
			Zangle+=ZanglePlus;
			yield;
		}
		ObjPrim_SetDestCenter(obj,128,64,144,96);
		loop(5)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=0.5/15;
			ObjRender_SetAngleZ(obj,Zangle);
			Zangle+=ZanglePlus;
			yield;
		}
		Obj_Delete(obj);
	}

}

task TShot2
{//サブ
	TShot3;//サブショットその２
	TShot4;//シルバーブレード
	let pShot=false;
	ShotCheck;
	let ShotDamage=2.0;
//	let DamageRate=1;
	let ShotAngle_P1=[270,0,0,0];
	let ShotAngle_P2=[250,290,0,0];
	let ShotAngle_P3=[290,250,270,0];
	let ShotAngle_P4=[275,264,270,270];
	let ShotAngle=[ShotAngle_P1,ShotAngle_P2,ShotAngle_P3,ShotAngle_P4];
	let ShotLag=0;
	loop
	{
		while(!pShot){ShotLag=0;yield;}
//		if(IsPlayerSpellActive){DamageRate=1.0;}
//		else{DamageRate=1.0;}
		if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_PUSH || GetVirtualKeyState(VK_SLOWMOVE)==KEY_HOLD)
		{

		}
		else
		{
			ascent(i in 0..PlayerPower_Int)
			{
				if(i>=2)
				{
					KnifeShot(OptionX[i],OptionY[i],270,ShotDamage,i);
				}
			}
		}
		ShotLag+=1;
		loop(6-(ShotLag%3==2)*3){yield;}
	}

	task ShotCheck
	{
		loop
		{
			if((GetVirtualKeyState(VK_SHOT)==KEY_PUSH || GetVirtualKeyState(VK_SHOT)==KEY_HOLD) && GetPlayerState==STATE_NORMAL && IsPermitPlayerShot)
			{
				pShot=true;
			}
			else
			{
				pShot=false;
			}
			yield;
		}
	}
}

task TShot3
{//サブ
	let pShot=false;
	ShotCheck;
	let ShotDamage=2.0;
//	let DamageRate=1;
	let ShotAngle_P1=[270,0,0,0];
	let ShotAngle_P2=[250,290,0,0];
	let ShotAngle_P3=[290,250,270,0];
	let ShotAngle_P4=[290,250,260,280];
	let ShotAngle=[ShotAngle_P1,ShotAngle_P2,ShotAngle_P3,ShotAngle_P4];
	let ShotLag=0;
	loop
	{
		while(!pShot){ShotLag=0;yield;}
//		if(IsPlayerSpellActive){DamageRate=1.0;}
//		else{DamageRate=1.0;}
		if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_PUSH || GetVirtualKeyState(VK_SLOWMOVE)==KEY_HOLD)
		{

		}
		else
		{
			ascent(i in 0..PlayerPower_Int)
			{
				KnifeShot(OptionX[i],OptionY[i],ShotAngle[PlayerPower_Int-1][i],ShotDamage,i);
				if(i<2)
				{
					KnifeShot(OptionX[i],OptionY[i],270,ShotDamage,i);
				}
			}
		}
		ShotLag+=1;
		loop(7+ShotLag%2){yield;}
	}

	task ShotCheck
	{
		loop
		{
			if((GetVirtualKeyState(VK_SHOT)==KEY_PUSH || GetVirtualKeyState(VK_SHOT)==KEY_HOLD) && GetPlayerState==STATE_NORMAL && IsPermitPlayerShot && !IsPlayerSpellActive)
			{
				pShot=true;
			}
			else
			{
				pShot=false;
			}
			yield;
		}
	}
}

task TShot4
{//サブ
	let pShot=false;
	ShotCheck;
	let ShotDamage=0;
//	let DamageRate=1;
	let ShotAngle_P1=[270,0,0,0];
	let ShotAngle_P2=[250,290,0,0];
	let ShotAngle_P3=[290,250,270,0];
	let ShotAngle_P4=[290,250,260,280];
	let ShotAngle=[ShotAngle_P1,ShotAngle_P2,ShotAngle_P3,ShotAngle_P4];
	let ShotCount=0;
	BladeExplode;

	loop
	{
		while(!pShot){ShotCount=0;yield;}
//		if(IsPlayerSpellActive){DamageRate=1.0;}
//		else{DamageRate=1.0;}
		if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_PUSH || GetVirtualKeyState(VK_SLOWMOVE)==KEY_HOLD)
		{
			if(ShotCount%15==0)
			{
				SilverBlade(OptionX[2],OptionY[2],270,ShotDamage,2);
				SilverBlade(OptionX[3],OptionY[3],270,ShotDamage,3);
			}
			if(ShotCount%15==4)
			{
				SilverBlade(OptionX[1],OptionY[1],270,ShotDamage,1);
			}
			if(ShotCount%15==8)
			{
				SilverBlade(OptionX[2],OptionY[2],270,ShotDamage,2);
				SilverBlade(OptionX[3],OptionY[3],270,ShotDamage,3);
			}
			if(ShotCount%15==12)
			{
				SilverBlade(OptionX[0],OptionY[0],270,ShotDamage,0);
			}
			ShotCount+=1;
		}
		else
		{

		}
		yield;
	}

	task ShotCheck
	{
		loop
		{
			if((GetVirtualKeyState(VK_SHOT)==KEY_PUSH || GetVirtualKeyState(VK_SHOT)==KEY_HOLD) && GetPlayerState==STATE_NORMAL && IsPermitPlayerShot && !IsPlayerSpellActive)
			{
				pShot=true;
			}
			else
			{
				pShot=false;
			}
			yield;
		}
	}
}

task BladeExplode
{
	loop
	{
		while(StingNum==0){yield;}
		while(StingNum<SilverBladeMax)
		{
			if(GetVirtualKeyState(VK_SLOWMOVE)!=KEY_HOLD){break;}
			yield;
		}
		if(StingNum==SilverBladeMax)
		{
			loop(20){yield;}
		}
		BladeExplodeFlag=true;
		while(StingNum>0){yield;}
		BladeExplodeFlag=false;
	}
}

let SilverBladeMax=22;
let SilverBladeNum=0;
let StingNum=0;
let BladeExplodeFlag=false;

task SilverBlade(x,y,angle,damage,Opnum)
{
	if(SilverBladeNum+StingNum==SilverBladeMax){return;}
	SilverBladeNum+=1;
	//angle+=rand(-5,5);
	let speed=3;
	let obj=CreatePlayerShotA1(x,y,0,angle,damage,1,33);
	let scale=1.0;
	Obj_SetRenderPriorityI(obj,40);
	ObjRender_SetScaleXYZ(obj,scale,scale,scale);
	let count=0;
	let OldX=x;
	let OldY=y;
	let Alpha=255;
	ObjShot_SetIntersectionEnable(obj,false);
	loop(40)
	{
		let nearObj=-1;
		let EnemyObjectArray=GetIntersectionRegistedEnemyID;
		let dis=0;
		let Dis=1000^2;
		if(length(EnemyObjectArray)!=0)
		{
			ascent(i in 0..length(EnemyObjectArray))
			{
			dis=(ObjRender_GetY(EnemyObjectArray[i])-ObjRender_GetY(obj))^2+(ObjRender_GetX(EnemyObjectArray[i])-ObjRender_GetX(obj))^2;
			if(dis<Dis)
			{
				nearObj=EnemyObjectArray[i];
				Dis=dis;
			}
			}
		}
		if(nearObj!=-1)
		{
			angle=atan2(ObjRender_GetY(nearObj)-ObjRender_GetY(obj),ObjRender_GetX(nearObj)-ObjRender_GetX(obj));
		}
		else{angle=270;}
		ObjMove_SetAngle(obj,angle);
		yield;
		if(Obj_IsDeleted(obj)){	return;	}
	}
	ObjShot_SetIntersectionEnable(obj,true);
	ObjMove_SetSpeed(obj,35);
	ObjShot_SetGraphic(obj,34);

	while(!Obj_IsDeleted(obj))
	{
		if(ObjCol_GetIntersectedCount(obj)>0 && length(ObjCol_GetListOfIntersectedEnemyID(obj))>0)
		{
//			PlaySE(SE_MISSILE2);
			Sting(obj,ObjCol_GetListOfIntersectedEnemyID(obj)[0],angle);
			break;
		}
		yield;
	}
	SilverBladeNum-=1;
	Obj_Delete(obj);

//	task Sting(objKnife,objEnemy,angle)
	function Sting(objKnife,objEnemy,angle)
	{
		StingNum+=1;
		Obj_SetValue(objEnemy,"SilverBladeSting",Obj_GetValueD(objEnemy,"SilverBladeSting",0)+1);
		let StingX=ObjMove_GetX(objKnife)-ObjMove_GetX(objEnemy);
		let StingY=ObjMove_GetY(objKnife)-ObjMove_GetY(objEnemy);
		StingEffect(StingX,StingY,objEnemy,angle);
	}

	task StingEffect(x,y,objEnemy,Zangle)
	{
		let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
		ObjPrim_SetTexture(obj,IMG_SHOT);
		ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjPrim_SetVertexCount(obj, 4);
		ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
		Obj_SetRenderPriorityI(obj,40);
		ObjRender_SetAngleZ(obj,0);

		ObjPrim_SetDestCenter(obj,192,196,208,224);

		ObjRender_SetPosition(obj,ObjMove_GetX(objEnemy)+x,ObjMove_GetY(objEnemy)+y,0);
		ObjRender_SetAngleZ(obj,Zangle+90);
		let Alpha=0.1;
		let R=255;
		let G=255;
		let B=255;
		let AnimeCount=0;
		let RectArray=[[192,192],[208,192],[224,192],[240,192],[192,224],[208,224],[224,224],[240,224]];
		while(!BladeExplodeFlag)
		{
			if(Obj_IsDeleted(objEnemy)){break;}
			if(Obj_IsDeleted(obj)){	break;	}
			ObjRender_SetPosition(obj,ObjMove_GetX(objEnemy)+x,ObjMove_GetY(objEnemy)+y,0);
			ObjPrim_SetDestCenter(obj,RectArray[floor(AnimeCount%8)][0],RectArray[floor(AnimeCount%8)][1],RectArray[floor(AnimeCount%8)][0]+16,RectArray[floor(AnimeCount%8)][1]+32);
			AnimeCount+=0.2;
			yield;
		}
		if(Obj_IsDeleted(obj)){
			StingNum -= 1;
			return;
		}
		if(Obj_IsDeleted(objEnemy)){StingNum-=1;}
		else
		{
			Explode(ObjRender_GetX(obj),ObjRender_GetY(obj),5.5+0.75*Obj_GetValueD(objEnemy,"SilverBladeSting",0));
			Obj_SetValue(objEnemy,"SilverBladeSting",Obj_GetValueD(objEnemy,"SilverBladeSting",0)-1);
		}
		yield;
		Obj_Delete(obj);
	}

	task Explode(x,y,ExpScale)
	{
		if(IsPermitPlayerShot()){
			ExpScale*=0.66;
			ExplodeEffect2;
			ExplodeEffect;
			ExplodeAttack;
		}
		if(StingNum==SilverBladeMax)
		{
//			PlaySE(SE_EXPLODE);
			loop(70){yield;}
		}
		StingNum-=1;
		
		task ExplodeAttack
		{
			let objAK = CreatePlayerShotA1(x,y,0,0,0.35,65525,33);
//			if(objAK != NULL){
				if(StingNum==SilverBladeMax)
				{
					if(OnSpell){
						ObjShot_SetDamage(objAK,0.65);
					}else{
						ObjShot_SetDamage(objAK,0.55);
					}
				}else if(OnSpell){
					ObjShot_SetDamage(objAK,0.45);
				}
				ObjRender_SetAlpha(objAK,0);
				let Scale=0;
				let ScaleSpeed=ExpScale/22/30*2;
				loop(30)
				{
					ScaleSpeed-=ExpScale/22/30/30;
					Scale+=ScaleSpeed;
					ObjShot_SetIntersectionCircleA1(objAK,Scale*48);
					yield;
				}
				loop(10)
				{
					ObjShot_SetIntersectionCircleA1(objAK,Scale*48);
					yield;
				}
				Obj_Delete(objAK);
//			}
		}

		task ExplodeEffect
		{
			let objExp = ObjPrim_Create(OBJ_PRIMITIVE_2D);
			ObjPrim_SetTexture(objExp,IMG_KNIFE_EXP);
			ObjPrim_SetPrimitiveType(objExp, PRIMITIVE_TRIANGLEFAN);
			ObjPrim_SetVertexCount(objExp, 4);
			ObjRender_SetBlendType(objExp, BLEND_ADD_RGB);
			Obj_SetRenderPriorityI(objExp,40);
			ObjRender_SetPosition(objExp,x,y,0);
			ObjRender_SetAngleZ(objExp,0);

			ObjPrim_SetDestCenter(objExp,0,0,128,128);
			let R=255;
			let G=255;
			let B=255;
			let Alpha=0.25;
			let Scale=0;
			let ScaleSpeed=ExpScale/22/30*2;
			let Zangle=0;
			let dir=rand_dir;
			ObjRender_SetColor(objExp,R*Alpha,G*Alpha,B*Alpha);
			loop(30)
			{
				ScaleSpeed-=ExpScale/22/30/30;
				Scale+=ScaleSpeed;
				ObjRender_SetScaleXYZ(objExp,Scale,Scale,1);
				ObjRender_SetAngleZ(objExp,Zangle);
				Zangle+=12.5*dir;
				yield;
			}
			loop(10)
			{
				ObjRender_SetAngleZ(objExp,Zangle);
				Zangle+=12.5*dir;
				yield;
			}
			let ScaleMax=Scale;
			loop(20)
			{
			//	Alpha-=1/10;
				Scale-=ScaleMax/20;
				ObjRender_SetScaleXYZ(objExp,Scale,Scale,1);
				ObjRender_SetColor(objExp,R*Alpha,G*Alpha,B*Alpha);
				ObjRender_SetAngleZ(objExp,Zangle);
				Zangle+=12.5*dir;
				yield;
			}
			Obj_Delete(objExp);
		}

		task ExplodeEffect2
		{
			let objExp = ObjPrim_Create(OBJ_PRIMITIVE_2D);
			ObjPrim_SetTexture(objExp,IMG_KNIFE_EXP);
			ObjPrim_SetPrimitiveType(objExp, PRIMITIVE_TRIANGLEFAN);
			ObjPrim_SetVertexCount(objExp, 4);
		//	ObjRender_SetBlendType(objExp, BLEND_ADD_RGB);
			Obj_SetRenderPriorityI(objExp,40);
			ObjRender_SetPosition(objExp,x,y,0);
			ObjRender_SetAngleZ(objExp,0);

			ObjPrim_SetDestCenter(objExp,128,0,256,128);
			let R=255;
			let G=255;
			let B=255;
			let Alpha=32;
			let AlphaMax=Alpha;
			let Scale=0;
			let ScaleSpeed=ExpScale/22/30*2;
			let Zangle=0;
			ObjRender_SetAlpha(objExp,Alpha);
			let dir=rand_dir;
			loop(30)
			{
				ScaleSpeed-=ExpScale/22/30/30;
				Scale+=ScaleSpeed;
				ObjRender_SetScaleXYZ(objExp,Scale,Scale,1);
				ObjRender_SetAngleZ(objExp,Zangle);
				Zangle+=12.5*dir;
				yield;
			}
			loop(35)
			{
				ObjRender_SetAngleZ(objExp,Zangle);
				Zangle+=12.5*dir;
				yield;
			}
			let ScaleMax=Scale;
			loop(10)
			{
				Alpha-=AlphaMax/10;
				Scale+=ExpScale/22/30;
				ObjRender_SetScaleXYZ(objExp,Scale,Scale,1);
				ObjRender_SetAlpha(objExp,Alpha);
				ObjRender_SetAngleZ(objExp,Zangle);
				Zangle+=12.5*dir;
				yield;
			}
			Obj_Delete(objExp);
		}
	}
}

task KnifeShot(x,y,angle,damage,Opnum)
{
	let speed=22.5;
	let obj=CreatePlayerShotA1(x,y,speed,angle,damage,1,31);
	Obj_SetRenderPriorityI(obj,40);
	let scale=1.0;
	ObjRender_SetScaleXYZ(obj,scale,scale,scale);
//	ObjRender_SetAlpha(obj,0);
	let OldX=x;
	let OldY=y;
	while(!Obj_IsDeleted(obj))
	{
		OldX=ObjMove_GetX(obj);
		OldY=ObjMove_GetY(obj);
		yield;
	}

	HitEffect(OldX,OldY,speed,angle);
	HitEffect2(OldX,OldY,speed,angle);
	Obj_Delete(obj);

	task HitEffect(x,y,speed,angle)
	{
		let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
		ObjPrim_SetTexture(obj,IMG_SHOT);
		ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjPrim_SetVertexCount(obj, 4);
		ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
		Obj_SetRenderPriorityI(obj,40);
		ObjRender_SetAngleZ(obj,angle+90);

		ObjPrim_SetDestCenter(obj,144,96,160,128);

		ObjRender_SetPosition(obj,x,y,0);
		speed/=8;
		let Scale=1;
		let Alpha=1.0;
		let R=255;
		let G=255;
		let B=255;
		loop(3)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=1.0/9;
			yield;
		}
		ObjPrim_SetDestCenter(obj,144,64,160,96);
		loop(3)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=1.0/9;
			yield;
		}
		ObjPrim_SetDestCenter(obj,144,32,160,64);
		loop(3)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=1.0/9;
			yield;
		}
		Obj_Delete(obj);
	}

	task HitEffect2(x,y,speed,angle)
	{
		angle+=180+rand(-90,90);
		let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
		ObjPrim_SetTexture(obj,IMG_SHOT);
		ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjPrim_SetVertexCount(obj, 4);
		ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
		Obj_SetRenderPriorityI(obj,40);

		ObjPrim_SetDestCenter(obj,144,96,160,128);

		ObjRender_SetPosition(obj,x,y,0);
		speed=rand(2.5,5);
		let Scale=1;
		let Alpha=0.5;
		let R=255;
		let G=255;
		let B=255;
		let Zangle=angle+90;
		let ZanglePlus=rand(10,20)*rand_dir;
		loop(10)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=0.5/15;
			ObjRender_SetAngleZ(obj,Zangle);
			Zangle+=ZanglePlus;
			yield;
		}
		ObjPrim_SetDestCenter(obj,144,64,160,96);
		loop(5)
		{
			ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed*cos(angle),ObjRender_GetY(obj)+speed*sin(angle),0);
			ObjRender_SetColor(obj,R*Alpha,G*Alpha,B*Alpha);
			Alpha-=0.5/15;
			ObjRender_SetAngleZ(obj,Zangle);
			Zangle+=ZanglePlus;
			yield;
		}
		Obj_Delete(obj);
	}
}