 
task optionmove//オプションの動き方。powerによって場合分け。時間差（1F後)で自機に追従する。
{

let TraceX=[];
let TraceY=[];
loop(48)
{
TraceX=TraceX~[GetPlayerX];
TraceY=TraceY~[GetPlayerY];
}
/*
loop
{
	TraceX=TraceX~[GetPlayerX];
	TraceY=TraceY~[GetPlayerY];
	TraceX=erase(TraceX,0);
	TraceY=erase(TraceY,0);
		opX[0]=TraceX[40]+0;
		opX[1]=TraceX[32]+0;
		opX[2]=TraceX[24]+0;
		opX[3]=TraceX[16]+0;
		opX[4]=TraceX[8]+0;
		opX[5]=TraceX[0]+0;
		opY[0]=TraceY[40]+0;
		opY[1]=TraceY[32]+0;
		opY[2]=TraceY[24]+0;
		opY[3]=TraceY[16]+0;
		opY[4]=TraceY[8]+0;
		opY[5]=TraceY[0]+0;
	yield;
}
*/
let OpAnglePlus=0;
let dir=1;
/*
let RightAngle=-15*2;
let LeftAngle=15;
*/
let MoveY=5;
OpAngle=270;
let R=[-27,27,-46,46,-65,65];
let R1=27;
let R2=45;
let R3=63;
let AdjustX=[0,0,0,0,0,0];
let AdjustY=[8,8,-2,-2,18,18];
let AdjustConuter=0;
let RockAngle=180;
let RockD1=75;
let RockD2=30;
let RockMove=false;
let RockX=0;
let RockY=0;
let tempB=0;
loop
{
	if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD || true)
	{
/*
		if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH)
		{
			ascent(i in 0..48)
			{
			TraceX[i]=GetPlayerX+0;
			TraceY[i]=GetPlayerY+0;
			}
			descent(i in 0..10)
			{
			if(GetKeyState(VK_SLOWMOVE)==KEY_PULL)
			{
				break;
			}
			ascent(j in 0..6)
			{
				let px=opX[j];
				let sx=GetPlayerX+R[j]+AdjustX[j];
				opX[j]=i/10*px+(10-i)/10*sx;
				let py=opY[j];
				let sy=GetPlayerY+AdjustY[j];
				opY[j]=i/10*py+(10-i)/10*sy;
			}
				yield;
			}
		}
*/
		if(TargetX[0]!=-1 && BurstLevel==3)
		{
			RockAngle=atan2(TargetY[0]-GetPlayerY,TargetX[0]-GetPlayerX)+105;
			if(!RockMove)
			{
			RockMove=true;
			let tempopX=[];
			let tempopY=[];
			ascent(i in 0..6)
			{
				tempopX=tempopX~[opX[i]];
				tempopY=tempopY~[opY[i]];
			}
			descent(i in 0..15)
			{
			RockAngle=atan2(TargetY[0]-GetPlayerY,TargetX[0]-GetPlayerX)+105;
			if(GetKeyState(VK_SLOWMOVE)==KEY_PULL)
			{
				ascent(j in 0..48)
				{
					TraceX[j]=GetPlayerX+0;
					TraceY[j]=GetPlayerY+0;
				}
			//	RockMove=false;
				break;
			}
			if(TargetX[0]<=0 || BurstLevel==0)
			{
			//	RockMove=false;
				break;
			}
			RockX=TargetX[0];
			RockY=TargetY[0];
			ascent(j in 0..6)
			{
				let px=tempopX[j];
				let sx=TargetX[0]+RockD1*cos(RockAngle+j*30);
				opX[j]=i/15*px+(15-i)/15*sx;
				let py=tempopY[j];
				let sy=TargetY[0]+RockD2*sin(RockAngle+j*30);
				opY[j]=i/15*py+(15-i)/15*sy;
			}
				yield;
			}
			}
			if(TargetX[0]>0)
			{
			RockAngle=atan2(TargetY[0]-GetPlayerY,TargetX[0]-GetPlayerX)+105;
			ascent(i in 0..6)
			{
				opX[i]=TargetX[0]+RockD1*cos(RockAngle+i*30);
				opY[i]=TargetY[0]+RockD2*sin(RockAngle+i*30);
			}
			
			}
		}
		else
		{
			if(RockMove==false)
			{
			opX[0]=GetPlayerX-R1+AdjustX[0];
			opX[1]=GetPlayerX+R1+AdjustX[1];
			opX[2]=GetPlayerX-R2+AdjustX[2];
			opX[3]=GetPlayerX+R2+AdjustX[3];
			opX[4]=GetPlayerX-R3+AdjustX[4];
			opX[5]=GetPlayerX+R3+AdjustX[5];
			opY[0]=GetPlayerY+AdjustY[0];
			opY[1]=GetPlayerY+AdjustY[1];
			opY[2]=GetPlayerY+AdjustY[2];
			opY[3]=GetPlayerY+AdjustY[3];
			opY[4]=GetPlayerY+AdjustY[4];
			opY[5]=GetPlayerY+AdjustY[5];
			}
			else if((RockMove || TargetX[0]!=-1))
			{
			descent(i in 0..60)
			{
			if(GetKeyState(VK_SLOWMOVE)==KEY_PULL)
			{
				ascent(j in 0..48)
				{
					TraceX[j]=GetPlayerX;
					TraceY[j]=GetPlayerY;
				}
				RockMove=false;
				break;
			}
			if(TargetX[0]!=-1 && BurstLevel==3)
			{
				RockMove=false;
				break;
			}
			let tempopX=[];
			let tempopY=[];
			ascent(i in 0..6)
			{
				tempopX=tempopX~[opX[i]];
				tempopY=tempopY~[opY[i]];
			}
			ascent(j in 0..6)
			{
				let px=tempopX[j];
				let sx=GetPlayerX+R[j]+AdjustX[j];
				opX[j]=i/60*px+(60-i)/60*sx;
				let py=tempopY[j];
				let sy=GetPlayerY+AdjustY[j];
				opY[j]=i/60*py+(60-i)/60*sy;
			}
				yield;
			}
			RockMove=false;
			}
		}
	}
	else
	{
		if(RockMove)
		{
			ascent(i in 0..6)
			{
			opX[i]=GetPlayerX+0;
			opY[i]=GetPlayerY+0;
			}	
		}
		if(GetKeyState(VK_SLOWMOVE)==KEY_PULL || tempB>BurstLevel)
		{
		ascent(i in 0..48)
		{
			TraceX[i]=GetPlayerX;
			TraceY[i]=GetPlayerY;
		}
		}
	TraceX=TraceX~[GetPlayerX];
	TraceY=TraceY~[GetPlayerY];
	TraceX=erase(TraceX,0);
	TraceY=erase(TraceY,0);
		opX[0]=TraceX[40]+0;
		opX[1]=TraceX[32]+0;
		opX[2]=TraceX[24]+0;
		opX[3]=TraceX[16]+0;
		opX[4]=TraceX[8]+0;
		opX[5]=TraceX[0]+0;
		opY[0]=TraceY[40]+0;
		opY[1]=TraceY[32]+0;
		opY[2]=TraceY[24]+0;
		opY[3]=TraceY[16]+0;
		opY[4]=TraceY[8]+0;
		opY[5]=TraceY[0]+0;
	}
	tempB=BurstLevel;
yield;
}
}


task OptionShot
{
loop
{
	ascent(let i in 0..4)
	{
		OptionAuraShot(i);
	}
	wait(600);
}
}

task OptionAuraShot(num)
{
	let obj= Obj_Create(OBJ_LASER);
	Obj_SetX(obj,opX[num]);
	Obj_SetY(obj,opY[num]+48);
	ObjShot_SetDamage(obj,0.2);
	ObjShot_SetPenetration(obj,65556);
	ObjShot_SetGraphic(obj,1);
	Obj_SetAngle(obj,270);
	ObjLaser_SetLength(obj,96);
	ObjLaser_SetWidth(obj,16);
	ObjLaser_SetSource(obj,false);
	Obj_SetAlpha(obj,0);

	loop(600)
	{
		if(BurstLevel==0)
		{
			ObjShot_SetDamage(obj,0.2);
		}
		if(BurstLevel==1)
		{
			ObjShot_SetDamage(obj,0.2*1.2);
		}
		if(BurstLevel==2)
		{
			ObjShot_SetDamage(obj,0.2*1.5);
		}
		if(BurstLevel==3)
		{
			ObjShot_SetDamage(obj,0.2*2);
		}
		if(GetKeyState(VK_SLOWMOVE)==KEY_FREE)
		{
			ObjShot_SetDamage(obj,0);
		}
	Obj_SetX(obj,opX[num]);
	Obj_SetY(obj,opY[num]+48);
	yield;
	}
	Obj_Delete(obj);
}