#e[Player]
#ScriptVersion[2]
#Menu[˖ ]
#Text[N[ ver1.01
@͕ԒƓł

100̎VbgL[ŎBe
ᑬAVbgŃ`[W

{͂܂
]
#Image[]
#Replayname[Aya]

script_player_main{


//\ݒ肱

  let deleteAllShot = true;			//trueFSĂ̒eł܂B
						//falseF{ϐ̖êݏ܂B

  let takePhoto = true;				//trueFBeɃXibvVbg܂B
						//falseFXibvVbg܂

  let chargeSpeed = 10 / 60;			//Pt[̃tBxB`[W3{
  let moveSpeed = [5.1, 2.3, 0.6];		//ꂼʏAᑬAړ̑x
  let chargeRate = 1/10;			//̗P̃tB[U񕜗
  let blankTime = 120;				//BeAď[U\ɂȂ܂ł̎
  let shotDeletePoint = 100;			//01̒ȇf_

  let finderCounterMax = 20;			//t@C_[[h̐
  let finderHorizonalMax = 240;			//t@C_[őTCY
  let finderVerticalMax = 180;			//t@C_[őTCYcic2xc ł肢܂j

  //-----[X[֌W
    let doSlow = false;		//[X[gpݒB
				//falseFʏ̃X[gp܂B
				//trueF[X[gp܂B

    let createPerFrame = 200;  	//_~[IuWFNg̃t[蔭{l
				//傫ƁAN܂ł̎ԂȂ܂B
				//A傫ƃt[Y鋰ꂪ܂̂ŒӁB

    let deletePerFrame = 2;  	//_~[IuWFNg̃t[{l
				//ɒpłBFPS肷Ԃ񕜂̂Ȃ܂B
				//A傫FPS傫h炮\܂̂ŒӁB

    let setFps = 20;	   	//ݒFPSl

  //-----

//܂

//f[^t@Cw
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";


//O[oϐ̒`
let keyStatus = [false, false, false, false, false, false, false]; //AEAAAVbgAᑬAɑΉ
let keyKind = [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_SHOT, VK_SLOWMOVE];
let filmCharge = 50;	//`[W
let finderFlag = false;	//t@C_[[htO
let objCursor;		//J[\IuWFNg
let blankCount = 0;	//BeɐFX邽߂̕ϐ
let timeOut=false;	//Ԑ؂tO
let filmStop=false;	//Rf[^"StopFilmCharge"
let shotBonus = [0,0,0,0,0,0,0];
let cursorCycle = 0;	//ӂӂp
let resultPoint = -1;	//ʐ^̕]_\p

//e̎ރe[u
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
		];

//e̎ޖ̓_[g
let shotPoint = [1, 1.5, 4, 1.1, 0.4, 0.7, 0.8, 1.3, 2, 0.7, 0.6, 2, 1.5];

//Rf[^ABet@Cp
let snapFile = ["bun00","bun01","bun02","bun03","bun04","bun05","bun06","bun07","bun08","bun09"];


@Initialize{

	//f[^ǂݍ
	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);
	}

	//FXN
	keyCheck();
	borderOfLife();
	shotRoutine();
	cursorMoving();
	filmCharging();
	slowMoveEffect();
	if(doSlow){slowShot();}		//thanks to Rial

}


@MainLoop{

	//xݒ
	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());
	}


	//[U\
	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);

	//{[iX\
	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;

		//ꂼ̃{[iX(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;
			}
		}

		//g[^_\
		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);
}

//L[`FbNtask
task keyCheck(){

	let noReactionTime = 4;	//ᑬL[𗣂Ă炱̃t[͎BełȂ
	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

//J[\^XN
task cursorMoving(){

	let curSpeed = 0;		//݂̃J[\x
	let curAngle = 270;		//݂̃J[\px
	let curRadius = 0;		//݂̃J[\a
	let setAngle = 270;		//J[\pxݒl
	let setRadius = 50;		//J[\aݒl		


	//J[\IuWFNg̐
	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);

	//GtFNg
	ascent(i in 0..2){cursorEffect(i);}

	//[v
	loop{
		if(!finderFlag){
			cursorSet01();
		}else{
			cursorSet02();
		}

		//J[\ݒnƁAړIʒuƂ̊pxo
		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;}
		}

		//a̍o
		local{
			let radBase = setRadius - curRadius;
			curRadius += radBase / 10;
			if(absolute(radBase) <1){curRadius = setRadius;}
		}

		//J[\̈ړ + ӂӂ
		let curAngle00 = curAngle + 5 * sin(cursorCycle * 3);
		let cursorX = GetPlayerX() + curRadius * cos(curAngle00);
		let cursorY = GetPlayerY() + curRadius * sin(curAngle00);
		Obj_SetPosition(objCursor,cursorX,cursorY);

		//J[\Lяk
		curAngle00 = 0.3 * sin(cursorCycle * 3);
		ObjEffect_SetScale(objCursor,1 + curAngle00, 1 + curAngle00);

		yield;

	}//end loop


    //-------------------------------
	//t@C_[[h
	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()){

				//{XȊOŕ̓Gꍇ
				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;

					//ԋ߂GɏƏ킹
					if( checkDistance01 < checkDistance00){
						distX = enemyX;
						distY = enemyY;
						checkDistance00 = checkDistance01;
					}
				}

			}else{
				//{X
				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

    //---------------------------
	//t@C_[[h
	function cursorSet02(){

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

		let speed = 8.2;	//J[\Xs[h
		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

    //------------------------
	//J[\GtFNg
	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;
		}

		//g
		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

//tBǗ^XN
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--;
		}

		//StopFilmChargetruêƂ
		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;
	}

    //-----------------------
	//`[WGtFNg֌W
	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


//[X[^XNϔŁi܂j
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

//ᑬړGtFNg
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]);
	}

	//At@ύXTu[`
	sub colorChange(){
		ascent(i in 0..10){
			ObjEffect_SetVertexColor(objSlow, i, [0,150][display],200,200,200);
		}
	}//end sub
	colorChange();

	//[v
	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

//GtFNgIuWFNg̏pt@NVBXYAUVȂ̐ݒ͊eXsƁB
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

//ꌅt@NV
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

//px`FbNpt@NV
function chAngle(angle){

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

	return angle;

}//end function

//EFCgt@NV
function waitTime(let time){

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

}//end function

//Vbg^XNCN[h
#include_function".\shoot_the_bullet.txt"

//ECN[h
#include_function".\BorderOfLife2.txt"

}//end script
