#東方弾幕風[Player]
#ScriptVersion[2]
#Menu[射命丸 文]
#Text[文クローン ver1.01
操作法は文花帖と同じです

100％の時ショットキーで撮影
低速、ショット同時押しでチャージ

ボムはありません
]
#Image[]
#Replayname[Aya]

script_player_main{


//性能設定ここから

  let deleteAllShot = true;			//true：全ての弾を消去できます。
						//false：ボム耐性の無い弾のみ消去します。

  let takePhoto = true;				//true：撮影時にスナップショットを取ります。
						//false：スナップショットを取りません

  let chargeSpeed = 10 / 60;			//１フレームあたりのフィルム巻き速度。チャージ中は3倍速
  let moveSpeed = [5.1, 2.3, 0.6];		//それぞれ通常、低速、超精密移動の速度
  let chargeRate = 1/10;			//光の粒１個あたりのフィルム充填回復量
  let blankTime = 120;				//撮影成功後、再充填可能になるまでの時間
  let shotDeletePoint = 100;			//種類01の弾を消した時の素点

  let finderCounterMax = 20;			//ファインダーモードの制限時間
  let finderHorizonalMax = 240;			//ファインダー最大サイズ横
  let finderVerticalMax = 180;			//ファインダー最大サイズ縦（縦＜横＜2x縦 でお願いします）

  //-----擬似スロー関係
    let doSlow = false;		//擬似スロー使用設定。
				//false：通常のスローを使用します。
				//true：擬似スローを使用します。

    let createPerFrame = 200;  	//ダミーオブジェクトのフレームあたり発生数基本値
				//数字が大きいと、処理落ちが起きるまでの時間が早くなります。
				//ただし、大きすぎるとフリーズする恐れがありますので注意。

    let deletePerFrame = 2;  	//ダミーオブジェクトのフレームあたり消去数基本値
				//主に調整用です。FPSが下がりすぎた状態から回復するのが早くなります。
				//ただし、大きすぎるとFPSが大きく揺らぐ可能性がありますので注意。

    let setFps = 20;	   	//設定FPS値

  //-----

//ここまで

//データファイル指定
let current = GetCurrentScriptDirectory();
let imgAya = current~".\img\Aya.png";
let imgBOL = current~".\img\BOL.png";
let imgShoot =current~".\img\shoot02.png";
let imgChar =current~".\img\Aya_char02.png";

let seReady =current~".\se\door02+.wav";
let seShoot =current~".\se\mecha22+.wav";
let seSuccess =current~".\se\cursor02+.wav";
let seFail =current~".\se\beep15+.wav";
let seFinder =current~".\se\wind01+.wav";
let seFastCharge =current~".\se\up01+.wav";


//グローバル変数の定義
let keyStatus = [false, false, false, false, false, false, false]; //左、右、上、下、ショット、低速、同時押しに対応
let keyKind = [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_SHOT, VK_SLOWMOVE];
let filmCharge = 50;	//チャージ量
let finderFlag = false;	//ファインダーモードフラグ
let objCursor;		//カーソルオブジェクト
let blankCount = 0;	//撮影後に色々するための変数
let timeOut=false;	//時間切れフラグ
let filmStop=false;	//コモンデータ"StopFilmCharge"
let shotBonus = [0,0,0,0,0,0,0];
let cursorCycle = 0;	//ふわふわ用
let resultPoint = -1;	//写真の評価点表示用

//弾の種類テーブル
let shotKind = [RED01,RED02,RED03,RED04,RED05,RED11,RED12,RED21,RED22,RED23,RED31,RED32,
		GREEN01,GREEN02,GREEN03,GREEN04,GREEN05,GREEN11,GREEN12,GREEN21,GREEN22,GREEN23,GREEN31,GREEN32,
		BLUE01,BLUE02,BLUE03,BLUE04,BLUE05,BLUE11,BLUE12,BLUE21,BLUE22,BLUE23,BLUE31,BLUE32,
		YELLOW01,YELLOW02,YELLOW03,YELLOW04,YELLOW05,YELLOW11,YELLOW12,YELLOW21,YELLOW22,YELLOW23,YELLOW31,YELLOW32,
		PURPLE01,PURPLE02,PURPLE03,PURPLE04,PURPLE05,PURPLE11,PURPLE12,PURPLE21,PURPLE22,PURPLE23,PURPLE31,PURPLE32,
		AQUA01,AQUA02,AQUA03,AQUA04,AQUA05,AQUA11,AQUA12,AQUA21,AQUA22,AQUA23,AQUA31,AQUA32,
		ORANGE01,ORANGE02,ORANGE03,ORANGE04,ORANGE05,ORANGE11,ORANGE12,ORANGE21,ORANGE22,ORANGE23,ORANGE31,ORANGE32,
		WHITE01,WHITE02,WHITE03,WHITE04,WHITE05,WHITE11,WHITE12,WHITE21,WHITE22,WHITE23,WHITE31,WHITE32
		];

//弾の種類毎の点数レート
let shotPoint = [1, 1.5, 4, 1.1, 0.4, 0.7, 0.8, 1.3, 2, 0.7, 0.6, 2, 1.5];

//コモンデータ、撮影ファイル用
let snapFile = ["bun00","bun01","bun02","bun03","bun04","bun05","bun06","bun07","bun08","bun09"];


@Initialize{

	//データ読み込み
	LoadGraphic(imgBOL);
	LoadGraphic(imgAya);
	LoadGraphic(imgShoot);
	LoadGraphic(imgChar);

	LoadSE(seReady);
	LoadSE(seShoot);
	LoadSE(seSuccess);
	LoadSE(seFail);
	LoadSE(seFinder);
	LoadSE(seFastCharge);

	LoadPlayerShotData(current~"Aya_Shot.txt");

	//初期設定
	SetPlayerLifeImage(imgAya, 7, 6, 39, 53);
	SetSpeed(moveSpeed[0], moveSpeed[1]);
	SetRebirthFrame(0);
	SetRebirthFrameReduction(0);
	SetItemCollectLine(0);
	SetInitialBombCount(0);
	SetGrazeCircle(0);
	SetAutoEffect(false);
	SetRenderState(ALPHA);
	SetGraphicAngle(0,0,0);

	ascent(i in 0..10){
		SetCommonData(snapFile[i],-1);
	}

	//色々起動
	keyCheck();
	borderOfLife();
	shotRoutine();
	cursorMoving();
	filmCharging();
	slowMoveEffect();
	if(doSlow){slowShot();}		//thanks to Ria様

}


@MainLoop{

	//速度設定
	if(!finderFlag && !timeOut){
		SetSpeed(moveSpeed[0], [moveSpeed[1],moveSpeed[2]][keyStatus[6]]);
	}else{
		SetSpeed(0,0);
	}

	//当り判定の設定
	SetIntersectionCircle(GetPlayerX(), GetPlayerY(), 1);

	//ふわふわ増加
	cursorCycle = chAngle(cursorCycle + 1);
	yield;
}

@SpellCard{

	AddBomb(1);
}

@DrawLoop{

	SetTexture(imgAya);
	SetGraphicExpansion(1, 1);
	SetColor(255, 255, 255);
	SetAlpha(255);

	//本体描画
	if(keyStatus[0] && !finderFlag){
		SetGraphicRect(7, 72, 39, 119);
	}else if(keyStatus[1] && !finderFlag){
		SetGraphicRect(7, 132, 39, 178);
	}else{
		SetGraphicRect(7, 6, 39, 53);
	}
	DrawGraphic(GetPlayerX(), GetPlayerY());

	//当たり判定表示
	if(keyStatus[5]){
		SetGraphicExpansion(0.4, 0.4);
		SetGraphicRect(69, 26, 86, 43);
		DrawGraphic(GetPlayerX(), GetPlayerY());
	}


	//充填率表示
	let string = [];
	SetTexture(imgChar);
	SetGraphicExpansion(0.6, 0.6);

	if(filmCharge ==100){
		let alpha = 160 + 40 * sin(cursorCycle * 10);
		drawChar(0,alpha);
		string = string ~ [1,0,0];

	}else if(finderFlag || timeOut){
		SetColor(135, 255, 135);
		SetGraphicExpansion(0.8,0.8);
		let string00 = [toInt(filmCharge,3),[0,0,0]][timeOut];
		string = string ~ string00;

	}else{
		let alpha = 220;
		if(blankCount != 0){
			if(blankCount == NULL){alpha = 0;}
			drawChar(2, alpha);
		}else{
			alpha = 100 + 40 * sin(cursorCycle * 4);
			drawChar(1, alpha);
		}

		if(blankCount != NULL){SetAlpha(150);}
		SetColor(230, 230, 230);
		string = toInt(filmCharge,3);
	}

	//数字
	ascent(i in 0..3){
		let number = string[i];
		drawChar(3,number);
		DrawGraphic(Obj_GetX(objCursor) - [34,26,18][i], Obj_GetY(objCursor) -8);
	}
	SetGraphicRect(99, 7, 113, 25);	
	DrawGraphic(Obj_GetX(objCursor) - 10, Obj_GetY(objCursor) -8);

	//ボーナス表示
	if(blankCount !=  0 && blankCount != NULL){
		//SetAlpha(200);
		SetAlpha([150,150,255,255][cursorCycle%4]);

		SetGraphicScale(0.5,0.5);	
		SetColor(255,255,255);
		let y = 8;

		//それぞれのボーナス(0:Enemy,1:Self,2:Two,3:Party,4:Risk,5:Color)
		ascent(i in 0..6){
			if(shotBonus[i] > 0){
				//種類
				let leng = trunc(log10(shotBonus[i])) + 1;
				let bonus = toInt(shotBonus[i],leng);
				let sX = drawChar(i + 4,0);
				DrawGraphic(Obj_GetX(objCursor) + 10 + (sX/2), Obj_GetY(objCursor) + y);

				//数字
				ascent(j in 0..length(bonus)){
					let number = bonus[j];
					let x = 80 + 6 * (j - length(bonus));
					//二桁の場合は小数点表示
					if(length(bonus) == 2 && j == 0){
						SetGraphicRect(104, 33, 108, 50);
						DrawGraphic(Obj_GetX(objCursor) + 69 , Obj_GetY(objCursor) + y);
						x = 66;  
					}
					drawChar(3,number);
					DrawGraphic(Obj_GetX(objCursor) + x , Obj_GetY(objCursor) + y);
				}
				y += 10;
			}
		}

		//トータル得点表示
		let total = toInt(resultPoint, 6);
		ascent(j in 0..length(total)){
			let number = total[j];
			let x = 80 + 6 * (j - length(total));
			drawChar(3,number);
			DrawGraphic(Obj_GetX(objCursor) + x , Obj_GetY(objCursor) + y);
		}
	}
}



@Missed{MainLoop}

@Finalize{

	DeleteGraphic(imgAya);
	DeleteGraphic(imgBOL);
	DeleteGraphic(imgShoot);
	DeleteGraphic(imgChar);

	DeleteSE(seReady);
	DeleteSE(seShoot);
	DeleteSE(seSuccess);
	DeleteSE(seFail);
	DeleteSE(seFinder);
	DeleteSE(seFastCharge);
}

//キーチェックtask
task keyCheck(){

	let noReactionTime = 4;	//低速キーを離してからこのフレーム数は撮影できない
	let noReact = 0;

	loop{
		filmStop = GetCommonDataDefault("StopFilmCharge",false);

		ascent(i in 0..6){
			keyStatus[i] = (GetKeyState(keyKind[i]) == KEY_PUSH || GetKeyState(keyKind[i]) == KEY_HOLD); 
			keyStatus[i] = (keyStatus[i] && !OnMissed() && !OnEvent() && !filmStop);
		}
		keyStatus[6] = (keyStatus[4] && keyStatus[5]);

		if(keyStatus[5] && !finderFlag){noReact=noReactionTime;}
		else if(noReact > 0){
			noReact--;
			keyStatus[4] = false;
		}

		yield;
	}

}//end task

//カーソルタスク
task cursorMoving(){

	let curSpeed = 0;		//現在のカーソル速度
	let curAngle = 270;		//現在のカーソル角度
	let curRadius = 0;		//現在のカーソル半径
	let setAngle = 270;		//カーソル角度設定値
	let setRadius = 50;		//カーソル半径設定値		


	//カーソルオブジェクトの生成
	objCursor = initEffect(imgAya, 4, 3);
	ascent(i in 0..4){
		ObjEffect_SetVertexXY(objCursor, i, [-20,20][trunc(i/2)], [-20,20][i%2]);
		ObjEffect_SetVertexUV(objCursor, i, [4,55][trunc(i/2)], [196,247][i%2]);
		ObjEffect_SetVertexColor(objCursor, i, 200, 220, 150, 150);
	}
	Obj_SetPosition(objCursor ,220, 400);

	//エフェクト
	ascent(i in 0..2){cursorEffect(i);}

	//ループ
	loop{
		if(!finderFlag){
			cursorSet01();
		}else{
			cursorSet02();
		}

		//カーソル現在地と、目的位置との角度差を割り出す
		local{
			let angleBase = setAngle - curAngle;
			if((angleBase > 0 && angleBase <= 180)||(angleBase <= -180)){
				curAngle = chAngle(curAngle + curSpeed);
			}else if((angleBase < 0 && angleBase > -180) || (angleBase >180)){
				curAngle = chAngle(curAngle - curSpeed);
			}

			if (absolute(angleBase) < (curSpeed *2)){curAngle = setAngle;}
		}

		//半径の差を割り出す
		local{
			let radBase = setRadius - curRadius;
			curRadius += radBase / 10;
			if(absolute(radBase) <1){curRadius = setRadius;}
		}

		//カーソルの移動 + ふわふわ
		let curAngle00 = curAngle + 5 * sin(cursorCycle * 3);
		let cursorX = GetPlayerX() + curRadius * cos(curAngle00);
		let cursorY = GetPlayerY() + curRadius * sin(curAngle00);
		Obj_SetPosition(objCursor,cursorX,cursorY);

		//カーソル伸び縮み
		curAngle00 = 0.3 * sin(cursorCycle * 3);
		ObjEffect_SetScale(objCursor,1 + curAngle00, 1 + curAngle00);

		yield;

	}//end loop


    //-------------------------------
	//非ファインダーモード時
	sub cursorSet01(){

		let distX = [0,-5][keyStatus[0]] + [0,5][keyStatus[1]];
		let distY = [0,-5][keyStatus[2]] + [0,5][keyStatus[3]];

		setRadius = 50;

		if(keyStatus[6] && filmCharge != 100){

			setRadius = 0;
			distX = GetEnemyX() - GetPlayerX();
			distY = GetEnemyY() - GetPlayerY();
			setAngle = chAngle(atan2(distY,distX));

		}else if((distX == 0 && distY == 0)|| keyStatus[5]){

			if(GetEnemyNum() > 1 && !IsBossExisting()){

				//ボス戦以外で複数の敵がいる場合
				distX = 430;
				distY = 480;
				let checkDistance00 = (distX^2 + distY^2)^0.5;

				ascent(enemy in EnumEnemyBegin..EnumEnemyEnd){
					let enemyID = EnumEnemyGetID(enemy);
					let enemyX = GetEnemyInfoDefault(enemyID, ENEMY_X,NULL) - GetPlayerX();
					let enemyY = GetEnemyInfoDefault(enemyID, ENEMY_Y,NULL) - GetPlayerY();	
					let checkDistance01 = (enemyX^2 + enemyY^2)^0.5;

					//一番近い敵に照準を合わせる
					if( checkDistance01 < checkDistance00){
						distX = enemyX;
						distY = enemyY;
						checkDistance00 = checkDistance01;
					}
				}

			}else{
				//ボス戦
				distX = GetEnemyX() - GetPlayerX();
				distY = GetEnemyY() - GetPlayerY();
			}

			setAngle = chAngle(atan2(distY,distX));
			curSpeed = [2,8][keyStatus[5]];

		}else{

			let checkAngle = chAngle(atan2(distY,distX)) - setAngle;
			if((checkAngle > 0 && checkAngle <= 180)||(checkAngle <= -180)){
				setAngle = chAngle(setAngle + 5);
			}else if(checkAngle != 0){
				setAngle = chAngle(setAngle - 5);
			}
			if(checkAngle < 6){setAngle = chAngle(atan2(distY,distX));}
			curSpeed = 4;
		}

	}//end sub

    //---------------------------
	//ファインダーモード時
	function cursorSet02(){

		ascent(i in 0..4){
			ObjEffect_SetVertexColor(objCursor,i,0,100,100,100);
		}

		let speed = 8.2;	//カーソルスピード
		while(finderFlag){
			let distX = [0,-5][keyStatus[0]] + [0,5][keyStatus[1]];
			let distY = [0,-5][keyStatus[2]] + [0,5][keyStatus[3]];
			if(distX != 0 || distY != 0){
				let angle = atan2(distY,distX);
				let x = Obj_GetX(objCursor) + speed * cos(angle);
				let y = Obj_GetY(objCursor) + speed * sin(angle);
				Obj_SetPosition(objCursor, x, y);
			}
			yield;
		}

		loop(5){yield;}
		while(timeOut){yield;}

		let distX = Obj_GetX(objCursor)-GetPlayerX();
		let distY = Obj_GetY(objCursor)-GetPlayerY();
		curAngle =  chAngle(atan2(distY,distX));
		curRadius = (distX^2+distY^2)^0.5;

		ascent(i in 0..4){
			ObjEffect_SetVertexColor(objCursor,i,200, 220, 150, 150);
		}

	}//end task

    //------------------------
	//カーソルエフェクト
	task cursorEffect(let num){

		let objCurEff= initEffect(imgAya,4,3);
		ascent(i in 0..4){
			ObjEffect_SetVertexXY(objCurEff,i,[-4,4][trunc(i/2)],[-4,4][i%2]);
			ObjEffect_SetVertexUV(objCurEff,i,[78,105][trunc(i/2)],[220,247][i%2]);
		}

		function vertexAlpha(let display){
			ascent(i in 0..4){
				ObjEffect_SetVertexColor(objCurEff,i,[0,100][display],100,100,100);
			}
		}//end function
		vertexAlpha(true);

		loop{
			let cycle = (cursorCycle * 7) + [0,180][num];
			let radius = [7,15][filmCharge==100];
			let scale = [0.5,1][filmCharge==100];

			if(filmCharge==100 && cursorCycle%3==0){cursorEffect02(cycle);}
			let posX = Obj_GetX(objCursor) + radius * cos(cycle);
			let posY = Obj_GetY(objCursor) + radius * sin(cycle);

			ObjEffect_SetScale(objCurEff, scale, scale);
			Obj_SetPosition(objCurEff, posX, posY);

			if(finderFlag){
				vertexAlpha(false);
				while(finderFlag || timeOut){yield;}
				waitTime(5);
				vertexAlpha(true);
			}
			yield;
		}

		//紅いやつ
		task cursorEffect02(let cycle00){

			let objEff= initEffect(imgAya,4,3);
			ascent(i in 0..4){
				ObjEffect_SetVertexXY(objEff,i,[-5,5][trunc(i/2)],[-5,5][i%2]);
				ObjEffect_SetVertexUV(objEff,i,[78,105][trunc(i/2)],[220,247][i%2]);
				ObjEffect_SetVertexColor(objEff,i,60,250,50,50);
			}

			ascent(i in 0..21){
				let posX = Obj_GetX(objCursor) + 15 * cos(cycle00);
				let posY = Obj_GetY(objCursor) + 15 * sin(cycle00);
				Obj_SetPosition(objEff, posX, posY);
				ObjEffect_SetScale(objEff,(1-i/20),(1-i/20));
				yield;
				if(finderFlag){break;}
			}

			Obj_Delete(objEff);		
		}//end task

	}//end task 

}//end task

//フィルム管理タスク
task filmCharging(){

	chargeEffect();

	loop{
		if(finderFlag){
			while(finderFlag){
				filmCharge -= 100 / finderCounterMax;
				yield;
			}
			filmCharge = 0;
		}

		if(filmCharge != 100 && blankCount <= 0){

			let chargeRate = [1,3][keyStatus[6]] * [3,1][IsBossExisting()];
			filmCharge += chargeSpeed * chargeRate;
			if(filmCharge >= 99){
				filmCharge = 100;
				PlaySE(seReady);
			}
			if(blankCount<0 && blankCount != NULL){blankCount++;}

		}else if(blankCount>0 && blankCount != NULL){
			blankCount--;
		}

		//StopFilmChargeがtrueのとき
		if(filmStop){
			filmCharge = 50;
			blankCount = 0;
			while(filmStop){yield;}
			ascent(i in 0..10){
				SetCommonData(snapFile[i],-1);
				DeleteCommonData(snapFile[i]~"XY");
			}
		}
		while(OnEvent()){yield;}

		yield;
	}

    //-----------------------
	//チャージエフェクト関係
	task chargeEffect(){

		loop{
			StopSE(seFastCharge);
			while(filmCharge == 100 || !keyStatus[6] || blankCount>0){yield;}

			PlaySE(seFastCharge);
			while(filmCharge != 100 && keyStatus[6]){
				yield;
				if(trunc(filmCharge)%2 == 0){fastChargeEffect(rand(0,359));}
			}

		}

		task fastChargeEffect(let angle){

			let objFast = initEffect(imgAya,4,2);
			ascent(i in 0..4){
				ObjEffect_SetVertexXY(objFast,i,[0,15][trunc(i/2)],[-5,5][i%2]);
				ObjEffect_SetVertexUV(objFast,i,[78,105][trunc(i/2)],[220,247][i%2]);
				ObjEffect_SetVertexColor(objFast,i,100,255,0,0);
			}
			ObjEffect_SetAngle(objFast,0,0,angle);

			ascent(i in 0..11){
				let radius = 80 * (1 - i/10);
				let posX = GetPlayerX() + radius * cos(angle); 
				let posY = GetPlayerY() + radius * sin(angle); 
				Obj_SetPosition(objFast, posX, posY);
				ObjEffect_SetScale(objFast,(1- i/10),(1- i/10));
				yield;
			}
			Obj_Delete(objFast);
		}

	}//end task

}//end task


//擬似スロータスク改変版（おまけ）
task slowShot(){

	let dummyNum = 0;

	//Spf = miliSecond per frame
	let setSpf = 1000 / setFps;
	let baseSpf = setSpf - 1000 / 60;
	let spf = 0;
	let oldTime = GetTime();


	loop{

		oldTime = GetTime();
		loop{
			spf = GetTime() - oldTime;
			oldTime = GetTime();
			if((spf < setSpf) && finderFlag){break;}
			yield;
		}

		let checkSpf = ((setSpf - spf) / baseSpf)^4;
		let dummyPerFrame = trunc(createPerFrame * checkSpf) + 1;

		loop(dummyPerFrame){
			dummyNum ++;
			dammy(dummyNum);
		}
		yield;

        }

    //--------------------
	task dammy(let num){

		let dammyShot= Obj_Create(OBJ_SHOT);

        	ObjShot_SetGraphic(dammyShot, 1);
		ObjShot_SetDamage(dammyShot, 0);
		ObjShot_SetPenetration(dammyShot, 1);
		Obj_SetPosition(dammyShot, 224,600);
		Obj_SetAutoDelete(dammyShot,false);
		Obj_SetAlpha(dammyShot, 0);     
		Obj_SetAngle(dammyShot,0);
		Obj_SetSpeed(dammyShot,0);
		Obj_SetCollisionToPlayer(dammyShot, false);

		while(finderFlag){
			let spfCheck = deletePerFrame * trunc(spf - setSpf);
			if(num >= (dummyNum - spfCheck)){
				break;
			}
			yield;
		}
		dummyNum--;
		Obj_Delete(dammyShot);

	}//end task

}//end task

//低速移動エフェクト
task slowMoveEffect(){

	let display = false;
	let slowAngle = 0;

	let objSlow = initEffect(imgAya,10,2);
	ObjEffect_SetPrimitiveType(objSlow, PRIMITIVE_TRIANGLEFAN);
	ObjEffect_SetVertexXY(objSlow, 0, 0, 0);
	ObjEffect_SetVertexUV(objSlow, 0, 51, 142);

	ascent(i in 1..10){
		let angle = i * (360/8);
		let rad = 28 * [1.41,1][i%2];
		ObjEffect_SetVertexXY(objSlow, i, rad * cos(angle), rad * sin(angle));
		ObjEffect_SetVertexUV(objSlow, i, [51,121,121,121][(i-1)%4],[72,72,142,72][(i-1)%4]);
	}

	//アルファ変更サブルーチン
	sub colorChange(){
		ascent(i in 0..10){
			ObjEffect_SetVertexColor(objSlow, i, [0,150][display],200,200,200);
		}
	}//end sub
	colorChange();

	//ループ
	loop{

		if((!display && keyStatus[5]) || (display && !keyStatus[5])){
			display=!display;
			colorChange();
			//ちょっと本家っぽく?
			if(keyStatus[5]){
				descent(i in 0..21){
					slowAngle = chAngle(slowAngle + 10);
					ObjEffect_SetAngle(objSlow,0,0,slowAngle);
					ObjEffect_SetScale(objSlow,1-(i/50),1-(i/50));
					Obj_SetPosition(objSlow,GetPlayerX(),GetPlayerY());
					if(!keyStatus[5]){break;}
					yield;
				}
			}
		}

		if(display){
			slowAngle = chAngle(slowAngle + 3);
			ObjEffect_SetAngle(objSlow,0,0,slowAngle);
			Obj_SetPosition(objSlow,GetPlayerX(),GetPlayerY());
		}
		yield
	}

}//end task

//エフェクトオブジェクトの初期化用ファンクション。XY、UV、その他の設定は各々行うこと。
function initEffect(let texture, let vertNum, let layer){

	let obj = Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(obj, texture);
	ObjEffect_SetRenderState(obj, ADD);
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj, vertNum);
	Obj_SetSpeed(obj,0);
	ObjEffect_SetLayer(obj, layer);
	Obj_SetAutoDelete(obj,false);

	return obj;

}//end function

//文字描画
function drawChar(let type,let alpha){

	alternative(type)
	case(0){
		SetColor(255,125,125);
		SetGraphicRect(0, 55, 63, 74);		//Enable
	}case(1){
		SetColor(220,220,220);
		SetGraphicRect(64, 55, 127, 74);	//Disable
	}case(2){
		SetColor(255,255,255);
		if(blankCount > 0){
			SetGraphicRect(0, 79, 127, 98);		//Successed
		}else{
			SetGraphicRect(0, 104, 127, 123);	//Failed
		}
	}case(3){
		let rectX = 5 + 15 * (alpha % 5);
		let rectY = 7 +  24 * trunc(alpha/5);
		SetGraphicRect(rectX, rectY, rectX + 13, rectY + 18);
		return;
	}case(4){
		SetGraphicRect(3, 124, 58, 148);	//EnemyShot
		return 27;
	}case(5){
		SetGraphicRect(1, 150, 41, 170);	//SelfShot
		return 19;
	}case(6){
		SetGraphicRect(81, 216, 115, 233);	//TwoShot
		return 17;
	}case(7){
		SetGraphicRect(2, 234, 53, 255);	//PartyShot
		return 25;
	}case(8){
		SetGraphicRect(65, 150, 103, 169);	//RiskShot
		return 19;
	}case(9){
		alternative(shotBonus[6])
		case(1){
			SetGraphicRect(3, 172, 70, 191);	//RainbowShot
			return 34;
		}case(2){
			SetGraphicRect(1, 193, 69, 212);	//ColorfulShot
			return 34;
		}case(3){
			SetGraphicRect(82, 174, 116, 190);	//RedShot
			return 17;
		}case(4){
			SetGraphicRect(2, 216, 53, 233);	//GreenShot
			return 25;
		}case(5){
			SetGraphicRect(81, 194, 115, 211);	//BlueShot
			return 17;
		}
	}

	let x = [20,42,0,0,0][trunc(type/2)];
	let y = [7,-8,0,0,0][trunc(type/2)];

	SetAlpha(alpha);
	DrawGraphic(Obj_GetX(objCursor) + x, Obj_GetY(objCursor) + y);

}//end function

//数字を一桁ずつ分けるファンクション
function toInt(let num01,let leng){

	if(num01<0){num01 = 0;}
	let string=[];
	ascent(i in 0..leng){
		let num02 = trunc(num01/(10^i))%10;
		string = [num02] ~ string;
	}

	return string;

}//end function

//角度チェック用ファンクション
function chAngle(angle){

	if (angle>=360){
		angle-=360;
	}else if (angle<0){
		angle+=360;
	}

	return angle;

}//end function

//ウェイトファンクション
function waitTime(let time){

	if(time <= 0){return;}
	loop(time){yield;}

}//end function

//ショットタスクをインクルード
#include_function".\shoot_the_bullet.txt"

//決死結界をインクルード
#include_function".\BorderOfLife2.txt"

}//end script
