task option{
      optiondeta(-6,-6,-40,-25,-30);
      optiondeta( 6, 6, 40, 25,-30);
}

task optiondeta(ShotAngle,Mangle1,normalX,slowX,slowY){
       let obj=Obj_Create(OBJ_EFFECT);
       let X=normalX;
       let Y=0;
       let angle=0;
       let frame=0;
       let OptionCount=0;
       let LazerSwich=false;
       Obj_SetAutoDelete(obj,false);
       ObjEffect_SetTexture(obj,imgPlayer);
       ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
       ObjEffect_CreateVertex(obj,4);
       ObjEffect_SetVertexXY(obj,0,-10,-10);
       ObjEffect_SetVertexXY(obj,1, 10,-10);
       ObjEffect_SetVertexXY(obj,2,-10, 10);
       ObjEffect_SetVertexXY(obj,3, 10, 10);
       ObjEffect_SetVertexColor(obj,0,255,255,255,255);
       ObjEffect_SetVertexColor(obj,1,255,255,255,255);
       ObjEffect_SetVertexColor(obj,2,255,255,255,255);
       ObjEffect_SetVertexColor(obj,3,255,255,255,255);
       ObjEffect_SetVertexUV(obj,0, 0,159);
       ObjEffect_SetVertexUV(obj,1,20,159);
       ObjEffect_SetVertexUV(obj,2, 0,179);
       ObjEffect_SetVertexUV(obj,3,20,179);
       loop{
	  if(GetCommonData("ResultTime") == 1){break;}
	  let Power=truncate(GetCommonData("Power")/100);
	  yield;
          Obj_SetPosition(obj,GetPlayerX+X,GetPlayerY+Y);
          if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){//低速移動時
		if(frame!=5){
			X-=slowX/5;
			Y+=slowY/5;
			frame++;
		}
	  	if(GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD){
			if(LazerSwich==false){
				OptionCount=0;
				LazerSwich=true;
				Lazer(-90+ShotAngle/4,Mangle1/2)
			}
		}
	  }
	  else{//高速移動時
		if(frame!=0){
			X+=slowX/5;
			Y-=slowY/5;
			frame--;
		}
	  	if(GetKeyState(VK_SHOT)==KEY_PUSH|| GetKeyState(VK_SHOT)==KEY_HOLD){
			if(LazerSwich==false){
				OptionCount=0;
				LazerSwich=true;
				Lazer(-90+ShotAngle,Mangle1)
			}
		}
	  }
          ObjEffect_SetAngle(obj,0,0,angle);
          angle+=3;
	  if(LazerSwich==true){OptionCount++;}
	  if(OptionCount>=40){
		LazerSwich=false;
	  }
       }

	task Lazer(Sangle,Mangle){
		Source;
		let Power=truncate(GetCommonData("Power")/100);
		let PointX=Obj_GetX(obj);
		let PointY=Obj_GetY(obj);
		let loops=1;
		if(Power>=1){loops=2;}//1で変わる
		if(Power>=4){loops=3;}//4で変わる
		loop(15){
			let angle=Sangle;
			loop(loops){
				if(Power==0||Power==1){CreatePlayerShot01(PointX, PointY,9,angle, 0.15, 2, 2);}
				if(Power==2||Power==3||Power==4){//2で変わる
					CreatePlayerShot01(PointX, PointY,9,angle, 0.30, 2, 3);
				}
				if(Power>=5){//5で変わる
					CreatePlayerShot01(PointX, PointY,9,angle, 0.40, 2, 4);
				}
				angle-=Mangle;
			}
			loop(2){yield;}
		}
	}
	task Source{//レーザー中心
		let PointX=Obj_GetX(obj);
		let PointY=Obj_GetY(obj);
		let objShot = Obj_Create(OBJ_SHOT);
		Obj_SetX(objShot,PointX);//x座標設定
		Obj_SetY(objShot,PointY);//y座標設定;
		Obj_SetSpeed(objShot,0);//速度設定
		ObjShot_SetGraphic(objShot, 5);//画像設定
		ObjShot_SetDamage(objShot, 0.5);//ダメージを設定
		ObjShot_SetPenetration(objShot,900);//貫通力
		Obj_SetAlpha(objShot,80);
		loop(30){yield;}
		ObjShot_FadeDelete(objShot);
	}


}


