//ݒ
function StartPlural()
{
	SetCommonData("plural", 1);
}

//ʒuݒ
function InitPosition(x, y)
{
	if( GetCommonDataDefault("plural", 0) || GetCommonDataDefault("stage", 0) ){
		SetMovePosition02(x, y, 60);
	}
	else{
		SetX(x);
		SetY(y);
	}
}

//Jnݒ
function StartSetting(time, score, name)
{
	SetTimer(time);
	if( score > 0 ){
		SetScore(score);
		CutIn(YOUMU, name, "", 0, 0, 0, 0);
	}
	T_CountDown();
}

//JEg_Eʉ炷
task T_CountDown()
{
	let c_time = GetTimer();
	let b_time = c_time;
	loop{
		c_time = GetTimer();
		if( c_time != b_time ){
			b_time = c_time;
			if( c_time <= 9 ){
				PlaySE(se_countdown);
			}
		}
		yield;
	}
}

//ړ֐̂P
function MoveActA(ymin, ymax)
{
	let x;
	let y;

	if( GetX() < GetPlayerX() ){
		x = min(GetX() + rand(50, 80), GetClipMaxX() - 64);
	}
	else{
		x = max(GetX() - rand(50, 80), GetClipMinX() + 64);
	}
	y = max(ymin, min(ymax, GetY() + rand(-30, 30)));
	SetMovePositionDC(x, y, 30);
}

//ړ^XN̂P
task T_MoveActA(wait, ymin, ymax)
{
	loop{
		let x;
		let y;

		if( GetX() < GetPlayerX() ){
			x = min(GetX() + rand(50, 80), GetClipMaxX() - 64);
		}
		else{
			x = max(GetX() - rand(50, 80), GetClipMinX() + 64);
		}
		y = max(ymin, min(ymax, GetY() + rand(-30, 30)));
		SetMovePositionDC(x, y, 30);
		Wait(wait);
	}
}

//ړ^XN̂Q
task T_MoveActB(wait, ymin, ymax)
{
	loop{
		let x;
		let y;

		if( GetX() < GetPlayerX() ){
			x = min(min(GetPlayerX(), GetX() + 60), GetClipMaxX() - 64);
		}
		else{
			x = max(max(GetPlayerX(), GetX() - 60), GetClipMinX() + 64);
		}
		y = max(ymin, min(ymax, GetY() + rand(-10, 10)));
		SetMovePositionDC(x, y, 10);
		Wait(wait);
	}
}

//ړ^XN̂R
task T_MoveActC(wait)
{
	loop{
		SetMovePosition02(GetPlayerX(), GetY(), wait);
		Wait(wait);
	}
}

//ړ֐~XeBAp
function MoveActM(ymin, ymax)
{
	let x;
	let y;
	let direction = 0;

	if( GetX() < GetClipMinX() + 152 ){
		direction = 1;
	}
	else if( GetX() > GetClipMaxX() - 152 ){
		direction = -1;
	}
	else if( GetX() < GetPlayerX() ){
		direction = 1;
	}
	else{
		direction = -1;
	}
	x = GetX() + direction * rand(120, 140);
	y = max(ymin, min(ymax, GetY() + rand(-30, 30)));
	SetMovePositionDC(x, y, 30);
	return direction;
}
