#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Tsugumi End"]

#include"./../../System/Miyako_Effect.txt"
#include"./LoadGraphics.txt"
#include"./LoadSounds.txt"

let bossObj;
let bossX;
let bossY;

#include"./MiyakoDrawBoss.txt"

@Initialize{
	bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	SetCommonData("ForceLifebar",1);
	SetAutoDeleteObject(true);
	ObjEnemy_Regist(bossObj);

	animateBossT;
	mainTask;}

@Event{
	alternative(GetEventType())
	case(EV_REQUEST_LIFE){SetScriptResult(1);}
	case(EV_REQUEST_TIMER){SetScriptResult(60);}}

@MainLoop{
	bossX = ObjMove_GetX(bossObj);
	bossY = ObjMove_GetY(bossObj);
	ObjEnemy_SetDamageRate(bossObj, 0, 0);
	ObjEnemy_SetIntersectionCircleToShot(bossObj,bossX,bossY,24);
	ObjEnemy_SetIntersectionCircleToPlayer(bossObj,bossX,bossY,32);
	yield;}

@Finalize{}

task mainTask{
	ObjMove_SetDestAtWeight(bossObj,CenterX,CenterY-100,5,3);
	let GetX = ObjMove_GetX(bossObj);
	let GetY = ObjMove_GetY(bossObj);
		yield;
		TExplosionA(GetX, GetY, 0, 2, 0.5, 0.2);wait(15);
		TExplosionA(GetX, GetY, 30, 2, 0.5, 0.2);wait(15);
		TExplosionA(GetX, GetY, -30, 2, 0.5, 0.2);wait(15);
		ObjEnemy_SetLife(bossObj,0);
		Obj_Delete(bossObj);yield;
	DeleteShotAll(TYPE_ALL,TYPE_ITEM);
	CloseScript(GetOwnScriptID());}