// w フレームだけ待つ
function wait(w) {
    loop(w) { yield; }
}
#include_script".\..\txt\Setting.txt"
#include_script".\..\txt\Achievement.txt"

let SE=["se\seSuperNaturalBorder1.wav",
	"se\seSuperNaturalBorder2.wav",
	"se\sePlayerShot01.wav",
	csd~"..\se\coin01.wav",
	csd~"..\se\cursor26.wav",
	csd~"..\se\cursor36.wav",
	csd~"..\se\shoot16_b.wav",
	"se\seScore.wav"];


task Obj_MoveHermite(obj,StartX,StartY,EndX,EndY,Size1,Angle1,Size2,Angle2,frame)
{
	let x=[0,0,0,0];
	let y=[0,0,0,0];
	let k;
	let count=0;
	loop(frame)
	{
		k=count/frame;
		x[0]=2*StartX+Size1*cos(Angle1)-2*EndX+Size2*cos(Angle2);
		x[1]=-3*StartX-2*Size1*cos(Angle1)+3*EndX-Size2*cos(Angle2);
		x[2]=Size1*cos(Angle1);
		x[3]=StartX;
		Obj_SetX(obj,x[0]*k^3+x[1]*k^2+x[2]*k+x[3]);

		y[0]=2*StartY+Size1*sin(Angle1)-2*EndY+Size2*sin(Angle2);
		y[1]=-3*StartY-2*Size1*sin(Angle1)+3*EndY-Size2*sin(Angle2);
		y[2]=Size1*sin(Angle1);
		y[3]=StartY;
		Obj_SetY(obj,y[0]*(k^3)+y[1]*(k^2)+y[2]*k+y[3]);
		count+=1;
		yield;
    	}
}

function KeyStateUp
{
	if(GetKeyState(VK_UP)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_UP)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_UP)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_UP)==KEY_FREE){return("FREE");}
}

function KeyStateDown
{
	if(GetKeyState(VK_DOWN)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_DOWN)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_DOWN)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_DOWN)==KEY_FREE){return("FREE");}
}

function KeyStateLeft
{
	if(GetKeyState(VK_LEFT)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_LEFT)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_LEFT)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_LEFT)==KEY_FREE){return("FREE");}
}

function KeyStateRight
{
	if(GetKeyState(VK_RIGHT)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_RIGHT)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_RIGHT)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_RIGHT)==KEY_FREE){return("FREE");}
}

function KeyStateShot
{
	if(GetKeyState(VK_SHOT)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_SHOT)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_SHOT)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_SHOT)==KEY_FREE){return("FREE");}
}

function KeyStateBomb
{
	if(GetKeyState(VK_BOMB)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_BOMB)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_BOMB)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_BOMB)==KEY_FREE){return("FREE");}
}

function KeyStateSlowMove
{
	if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_SLOWMOVE)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_SLOWMOVE)==KEY_FREE){return("FREE");}
}

function KeyStateSkip
{
	if(GetKeyState(VK_SKIP)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_SKIP)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_SKIP)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_SKIP)==KEY_FREE){return("FREE");}
}

function KeyStateUser
{
	if(GetKeyState(VK_USER)==KEY_PUSH){return("PUSH");}
	if(GetKeyState(VK_USER)==KEY_HOLD){return("HOLD");}
	if(GetKeyState(VK_USER)==KEY_PULL){return("PULL");}
	if(GetKeyState(VK_USER)==KEY_FREE){return("FREE");}
}