script_enemy_main {
	let bossImage = GetCurrentScriptDirectory~"yukari.png";
	let bossBack = GetCurrentScriptDirectory~"yukariback.png";
	@Initialize {
		if(GetPlayerType==USER_PLAYER) { RaiseError("Why are you using this player","Error"); }
		SetLife(1000);
		SetDamageRate(20, 50);
		SetTimer(65);
		LoadGraphic(bossImage);
		LoadGraphic(bossBack);
		SetText(""\""Boundary of Distance and Time"\");
		SetScore(10000);
	}
	let frame = -120;
	let frame2 = -120;
	let x = 0; let y = 0;
	let a = 0;
	@MainLoop {
		if(!OnBomb && GetTimeOfPlayerInvincibility == 0) { SetCollisionA(GetX, GetY, 50); } else { AddLife(5); }
		SetCollisionB(GetX, GetY, 50);
		if(frame == -120) {
			SetMovePosition02(GetCenterX, GetCenterY/2, 15);
			Concentration01(120);
		}
		frame++;
		frame2++;
		if(frame > 0 && frame <= 90) {
			loop(3) { CreateShot01(GetX, GetY, rand(1,4), rand(0,360), BLUE32, 10); }
			loop(1) { CreateShot01(GetX, GetY, rand(1,4), GetAngleToPlayer+rand(-50,50), BLUE32, 10); }
		}
		if(frame == 90) { TimeStop(90, 1, 1, 1); x = GetPlayerX; y = GetPlayerY; a = rand(0,360); }
		if(frame > 90 && frame <= 120) {
			ascent(i in 0..4) {
				let x_ = x+100*cos(a+i*360/4);
				let y_ = y+100*sin(a+i*360/4);
				if(x_ > GetClipMaxX) { x_ = GetClipMaxX; } if(x_ < GetClipMinX) { x_ = GetClipMinX; }
				if(y_ > GetClipMaxY) { y_ = GetClipMaxY; } if(y_ < GetClipMinY) { y_ = GetClipMinY; }
				CreateShot01(x_, y_, 1+(120-frame)/10, a+i*360/4+180, RED31, 20); }
			a+=360/20;
		}
		if(frame >= 450) { frame = 0; }
	}
	@DrawLoop {
		SetTexture(bossImage);
		SetGraphicRect(0, 0, 128, 128);
		SetGraphicScale(1, 1);
		SetGraphicAngle(0, 0, 0);
		SetAlpha(255);
		SetRenderState(ALPHA);
		DrawGraphic(GetX, GetY);
		DrawText("Past Yukari Yakumo", 40, 30, 12, 255);
	}
	let backspin = 0;
	@BackGround {
		SetTexture(bossBack);
		SetGraphicRect(0, 0, 512, 512);
		SetGraphicScale(3/2, 3/2);
		SetGraphicAngle(0, 0, backspin);
		SetAlpha(255);
		SetRenderState(ADD);
		DrawGraphic(GetCenterX, GetCenterY);
		backspin+=1; backspin%=360;
	}
	@Finalize {
		DeleteGraphic(bossImage);
		DeleteGraphic(bossBack);
		if(IsTimeOut) { ExtendPlayer(-GetPlayerLife); ShootDownPlayer; }
	}
}