
    /*------------------ショット------------------------*/
        
    let rMax = 180; //半径最大値
    let r1speed = 3; //拡大時のスピード
    let r2time = 80; //停止時間
    let r3speed = 0.2; //縮小時のスピード
    let rMin = 28; //半径収束値
    let cicle = false; //１サイクル終了するとfalse(途中の強制終了もあり)
    let r;
    
    task Tcicle{
        cicle = true;
        r=0;
        while(r<rMax){
            wait(1);
            if(!OnNormal){break;}
            r += r1speed;
        }
        loop(r2time){
            if(!OnNormal){break;}
            yield;
        }
        while(r>=rMin){
            wait(1);
            if(!OnNormal){break;}
            r -= r3speed;
        }
        cicle = false;
    }
 
    
    //進行方向交互に変わるストライプショット。半径(r-2)内のみ実体化
    task Tshot01(interval, tilt, color){ //interval:弾の間隔  tilt:傾き
        let column = 20; //列の間隔
        //let interval = 51;//弾の間隔
        let speed = 0.3; //弾のスピード //(interval/speed)は整数が望ましい
        let countA = 0;
        let sym = 1;
        loop{
            let shotP = column*(countA + 0.5); //shotP:弾の進行方向と垂直方向の座標（X中央中心）
            if(shotP >= rMax){break;}
            let countB = 0;
            loop{
                let shotQ = interval*countB; //shotQ:弾の進行方向座標（Y中央から-rMax*symが中心）
                if(shotQ >= rMax*2){break;}
                let shotX = shotP*cos(tilt) - (shotQ-rMax)*sym*sin(tilt); //弾のX座標
                let shotY = shotP*sin(tilt) + (shotQ-rMax)*sym*cos(tilt); //弾のY座標
                Fireshot01(shotX, shotY, sym);
                if(countB == 0){Tshot01B(shotX, shotY, sym);} //開始点からTshot01Bを行う
                countB++;
                if(countB == 200){break;} //永久ループ回避用
            }
            sym *= -1;
            countA++;
            if(countA == 100){break;} //永久ループ回避用
        }
        
        //ここから関数内関数
        task Tshot01B(shotX, shotY, symbol){
            loop{
                wait(interval/speed);
                if(!cicle){break;}
                Fireshot01(shotX, shotY, symbol);
            }
        }
        function Fireshot01(shotX, shotY, symbol){
            Tshot01A(shotX + GetCenterX, shotY + GetCenterY, speed, tilt+90*symbol, color);
            Tshot01A(-shotX + GetCenterX, -shotY + GetCenterY, speed, tilt-90*symbol, color);
        }
    }
    
    task Tshot01A(x, y, speed, angle, color){ //出現位置の(x,y)及びショット方向
        let shot = Obj_Create(OBJ_SHOT);
        Obj_SetPosition(shot, x, y);
        Obj_SetSpeed(shot, speed);
        Obj_SetAngle(shot, angle);
        ObjShot_SetGraphic(shot, color);
        let count=0;
        loop{
            //サイクル終了したらフェードアウト
            if(!cicle){ObjShot_FadeDelete(shot); break;}
            //充分な距離動いたら終了
            else if(speed*count>rMax*2){break;}
            //半径(r-5)内のとき実体化
            else if(Distance(Obj_GetX(shot), Obj_GetY(shot), GetCenterX, GetCenterY) < (r-8)){
                Obj_SetAlpha(shot, 255);
                Obj_SetCollisionToPlayer(shot, true);
            }
            //半径r内のとき半実体化
            else if(Distance(Obj_GetX(shot), Obj_GetY(shot), GetCenterX, GetCenterY) < (r-4)){
                Obj_SetAlpha(shot, 100);
                Obj_SetCollisionToPlayer(shot, false);
            }
            //半径外のとき非実体化
            else{
                Obj_SetAlpha(shot, 0);
                Obj_SetCollisionToPlayer(shot, false);
            }
            count++;
            yield;
        }
        Obj_Delete(shot);
    }
    
    //輪状に広がる弾幕
    task Tshot02(tilt, color){
        let num = 32;
        ascent(i in 0..num){
            let angle = 360/num*i;
            if(angle == 0 || angle == 90 || angle == 180 || angle == 270){}
            else{
                angle += tilt; //傾き追加
                let shot = Obj_Create(OBJ_SHOT);
                Obj_SetPosition(shot, GetCenterX, GetCenterY);
                Obj_SetSpeed(shot, r1speed);
                Obj_SetAngle(shot, angle);
                ObjShot_SetGraphic(shot, color);
                Tshot02A(shot, angle);
            }
        }
        task Tshot02A(shot, angle){
            let count =0;
            wait(rMax/r1speed);
            Obj_SetSpeed(shot, 0);
            Obj_SetAngle(shot, angle-180);
            wait(r2time);
            Obj_SetSpeed(shot, r3speed);
            loop{
                if(!cicle){break;}
                //if(Obj_BeDeleted(shot)){cicle=false; break;}//ボムなどで陣形が崩れた場合
                yield;
            }
            Obj_SetSpeed(shot, 0);
            ObjShot_FadeDelete(shot);
        }
    }
    
    task Tlaser01(sym, color){
        let num = 8;
        ascent(i in 0..num){
            let angle = 360/num*i*sym;
            let laser = Obj_Create(OBJ_LASER);
            ObjShot_SetGraphic(laser, color);
            ObjLaser_SetLength(laser, 200);
            ObjLaser_SetWidth(laser, 15);
            Obj_SetAlpha(laser, 100);
            ObjLaser_SetSource(laser, false);
            Obj_SetCollisionToPlayer(laser, false);
            Tlaser01A(laser, angle);
        }
        
        task Tlaser01A(laser, angle){
            let count = 0;
            loop{
                if(count == r2time + 180){
                    ObjLaser_SetWidth(laser, 30);
                    Obj_SetAlpha(laser, 255);
            		ObjLaser_SetSource(laser, true);
                    Obj_SetCollisionToPlayer(laser,true);
                }
                Obj_SetPosition(laser, GetCenterX + r*cos(angle), GetCenterY + r*sin(angle));
                Obj_SetAngle(laser, angle);
                //サイクル終了したらフェードアウト
                if(!cicle){ObjShot_FadeDelete(laser); break;}
                angle += sym;
                count++;
                yield;
            }
        }
    }
    
    //追跡弾
    task Tshot03(angle, color){
    	let obj = Obj_Create(OBJ_SHOT);
    	ObjShot_SetGraphic(obj, color);
    	Obj_SetPosition(obj, GetX, GetY);
    	Obj_SetAngle(obj, angle);
    	Obj_SetSpeed(obj, 2);
    	wait(100);
    	let add_speed = 5; //加速度？
    	let up = 0.05;
    	let down = -0.05;
    	let corn = 2.2; //スピードに対する角速度の上限
    	loop{
    		let to_p_angle = atan2(GetPlayerY-Obj_GetY(obj), GetPlayerX-Obj_GetX(obj));
    		let g_angle = Obj_GetAngle(obj);
    		let d_angle = to_p_angle - g_angle;//角度差分
    		let new_angle = sin(d_angle)*add_speed;
    		if(new_angle > corn){new_angle = corn;}
    		if(new_angle < -corn){new_angle = -corn;}
    		let plus_speed = cos(d_angle)*add_speed;
    		if(plus_speed > up){plus_speed = up;}
    		if(plus_speed < down){plus_speed = down;}
    		let new_speed = Obj_GetSpeed(obj) + plus_speed;
    		if(new_speed > 2){new_speed = 2;}
    		if(new_speed < 1){new_speed = 1;}
    		Obj_SetAngle(obj, g_angle + new_angle);
    		Obj_SetSpeed(obj, new_speed);
            //サイクル終了したらフェードアウト
            //if(!cicle){break;}
    		yield;
    	}
    }
    
    task Tshot04(color){
    	let obj = Obj_Create(OBJ_SHOT);
    	Obj_SetPosition(obj, GetX, GetY);
    	ObjShot_SetGraphic(obj, color);
    	Obj_SetAutoDelete(obj, false); //外へ出ても消えない
    	let speed = 4;
    	let obj_x;
    	let obj_y;
    	loop(7){
    		obj_x = Obj_GetX(obj);
    		obj_y = Obj_GetY(obj);
	    	Obj_SetSpeed(obj, speed);
	    	Obj_SetAngle(obj, atan2(GetPlayerY-obj_y, GetPlayerX-obj_x));
	    	Tkiseki;
    		wait(30);
    		Obj_SetAccel(obj, -0.2, 0);
    		wait(40);
    		if(!cicle){break;}
    	}
		obj_x = Obj_GetX(obj);
		obj_y = Obj_GetY(obj);
    	Obj_SetSpeed(obj, speed);
    	Obj_SetAngle(obj, atan2(GetPlayerY-obj_y, GetPlayerX-obj_x));
    	Obj_SetAutoDelete(obj, true);
    	
    	task Tkiseki{
    		let laser = Obj_Create(OBJ_LASER);
    		Obj_SetPosition(laser, obj_x, obj_y);
    		Obj_SetAngle(laser, Obj_GetAngle(obj));
    		ObjShot_SetGraphic(laser, YELLOW12);
    		ObjLaser_SetSource(laser, false);
    		ObjLaser_SetWidth(laser, 6);
    		loop(70){
    			ObjLaser_SetLength(laser, ((obj_x-Obj_GetX(obj))^2+(obj_y-Obj_GetY(obj))^2)^0.5);
    			yield;
    		}
    		wait(100);
    		ObjShot_FadeDelete(laser);
    	}
    }
    
   /*------------------便利関数------------------------*/
    /*AとBの距離を得る*/
    function Distance(A_X, A_Y, B_X, B_Y)
    {return ((A_X-B_X)^2+(A_Y-B_Y)^2)^0.5;}
       
    //ボム非発動時、自機通常時にtrueを返す
    function OnNormal{
        if(OnPlayerMissed){return false;}
        else if(OnBomb){return false;}
        return true;
    }
	
	/*オブジェクト弾に加速度を与える。accel:加速度　spMax:最大（最小）速度*/
	/*この間に他にて速度の変更をしないように*/
	task Obj_SetAccel(obj, accel, spMax){
	    if(!(accel == 0)){ //加速度が与えられていない場合、この関数は無効
	        let new_sp;
	        loop{
	            new_sp = Obj_GetSpeed(obj) + accel;
	            if((spMax-new_sp)*accel<=0){Obj_SetSpeed(obj, spMax); break;}
	            Obj_SetSpeed(obj, new_sp);
	            yield;
	        }
	    }
	}
    /*------------------終わり--------------------------*/
    #include_function ".\lib_anime_Yuka.txt"
    #include_function ".\basic_function.txt"
    #include_function ".\data.txt"