let img_bg1 = GetCurrentScriptDirectory() ~ "img\bg_yukari1.png";
let img_bg2 = GetCurrentScriptDirectory() ~ "img\bg_yukari2.png";
let bg_angle = 45;
let bg_alpha = 0.0;

@BackGround()
{
	SetTexture(img_bg1);
	SetGraphicRect(0, 0, 384, 448);
	SetAlpha(255 * bg_alpha);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX(), GetCenterY());

	SetTexture(img_bg2);
	SetGraphicRect(0, 0, 600, 600);
	SetAlpha(64 * bg_alpha);
	SetGraphicAngle(0, 0, bg_angle);
	DrawGraphic(GetCenterX(), GetCenterY());
	SetGraphicAngle(0, 0, bg_angle + 45);
	DrawGraphic(GetCenterX(), GetCenterY());

	SetAlpha(255);
	SetGraphicAngle(0, 0, 0);
}

task InitializeBG()
{
	LoadGraphic(img_bg1);
	LoadGraphic(img_bg2);

	loop{
		bg_angle -= 0.15;
		if( bg_angle >= 360 ){
			bg_angle -= 360;
		}
		bg_alpha = min(bg_alpha + 0.01, 1.0);
		yield;
	}
}

function ClearBG()
{
	DeleteGraphic(img_bg1);
	DeleteGraphic(img_bg2);
}
