//#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Intro"]
#include "./sharedfuncMario.dnh"



let objBoss;
let width = 384;
let height = 448;
let life = 1;
let scene = GetEnemyBossSceneObjectID();

@Event{
    alternative(GetEventType())
    case(EV_REQUEST_LIFE){
        SetScriptResult(life);
    }
    case(EV_REQUEST_TIMER){
        SetScriptResult(10);
    }
}


@Initialize{
    objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
    ObjEnemy_Regist(objBoss);
	
	animNon(objBoss);
	TFinalizeFade;
	
	
    ObjMove_SetDestAtFrame(objBoss, width/2, 3*height/5, 60);
	Main;
}


@MainLoop{
    ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32); 
    ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 28);
    yield;
}


task Main{
    Indicator(objBoss);
    SetForbidPlayerShot(true);
    ObjEnemy_SetDamageRate(objBoss, 0,0);
    wait(60);
	text("Hello, hello, hello: this is[r]The Warwick Touhou Project!", 150);
	wait(150);
	text("My name is Mario Micallef[r] and I am going[r]to destroy you.", 150);
	wait(150);
	text("Let's do some[r] vector analysis,[r]danmaku style!", 150);
	wait(150);
	ObjEnemy_SetLife(objBoss, 0);
}


task TFinalizeFade {
    while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
	Obj_Delete(objBoss);
    SetAutoDeleteObject(true);
    CloseScript(GetOwnScriptID());
    return;
}
