// ムラサの基本設定＆関数まとめ

let imgBoss	= GetCurrentScriptDirectory() ~ "\img\mychara.png";

let ANIME_FLAG = 0;

//魔方陣
let CC_RED	= 128;
let CC_GREEN	= 192;
let CC_BLUE	= 255;

#include_function ".\lib\common.txt"

// グラフィックの設定
sub setGraphicStop   { SetGraphicRect(  0, 288,  64, 384); }
sub setGraphicLeft   { SetGraphicRect(128, 288, 192, 384); }
sub setGraphicRight  { SetGraphicRect( 64, 288, 128, 384); }
sub setGraphicAttack { SetGraphicRect(256, 288, 320, 384); }
sub setGraphicAttack2{ SetGraphicRect(192, 288, 256, 384); }

sub setGraphicMove {
//	SetTexture(imgBoss);
	if(GetSpeedX == 0) {
		setGraphicStop;
	} else if(GetSpeedX < 0) {
		setGraphicLeft;
	} else {
		setGraphicRight;
	}
}

sub Draw_Murasa
{
//	SetTexture(imgBoss);
	if (!ATTACK_FLAG)
	{
		if(GetSpeedX == 0) {
			setGraphicStop;
		} else if(GetSpeedX < 0) {
			setGraphicLeft;
		} else {
			setGraphicRight;
		}
	}
	else
	{
		if (ANIME_FLAG == 1)
			{ setGraphicStop; }
		else if (ANIME_FLAG == 2)
			{ setGraphicAttack; }
		else if (ANIME_FLAG == 3)
			{ setGraphicAttack2; }
		else if (ANIME_FLAG == 4)
			{ SetGraphicAngle(180, 0, 0); setGraphicStop; }
		else if (ANIME_FLAG == 5)
			{ SetGraphicAngle(180, 0, 0); setGraphicAttack; }
		else if (ANIME_FLAG == 6)
			{ SetGraphicAngle(180, 0, 0); setGraphicAttack2; }
	}
	
	DrawGraphic(GetX, GetY);
}

// 1=左 2=右 0=解除
task splash_hishaku(muki)
{
	if (muki == 1)
	{
		SetGraphicAngle(0, 0, 0);
		ATTACK_FLAG = 1;  ANIME_FLAG = 1;
		wait(5);
		 ANIME_FLAG = 2;
		wait(5);
		if (ATTACK_FLAG) {  ANIME_FLAG = 3; }
	}
	else if (muki == 2)
	{
		SetGraphicAngle(180, 0, 0);
		ATTACK_FLAG = 1; ANIME_FLAG = 4;
		wait(5);
		ANIME_FLAG = 5;
		wait(5);
		if (ATTACK_FLAG) {  ANIME_FLAG = 6; }
	}
	else
	{
		ATTACK_FLAG = 0;
	}
}
