    //#TouhouDanmakufu[Single]
    #ScriptVersion[3]
    #Title["ZT Testing Script"]
    #Text["Karya Pertama HilmyNS[r]Tembakan All-Star[r][r]Tempat Tes ZT :3"]
    #BGM["script/ZT/music/LGA.ogg"]
    #include "script/default_system/Default_ShotConst.txt"
	#include "script/ZT/Library.txt"
	#include "script/default_system/Default_Effect.txt"
	
    let objBoss;
    let count = 0;
	let bossX = 0;
	let bossY = 0;
	
    @Event{
        alternative(GetEventType())
        case(EV_REQUEST_LIFE){
            SetScriptResult(5000);
        }
        case(EV_REQUEST_TIMER){
            SetScriptResult(99);
        }
        case(EV_REQUEST_SPELL_SCORE){
            SetScriptResult(1000000);
        }
    }
    @Initialize{
        objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
        ObjEnemy_Regist(objBoss);
        let ZeroTwoPixel = GetCurrentScriptDirectory() ~ "img/ZeroTwoPixel.png";
        ObjPrim_SetTexture(objBoss, ZeroTwoPixel);
        ObjSprite2D_SetSourceRect(objBoss, 0, 0, 20, 49);
        ObjSprite2D_SetDestCenter(objBoss);
        ObjMove_SetDestAtFrame(objBoss, GetCenterX(), 60, 60);
		BossMove;
		BossReallyMove;
		Aura;
        TFinalize;
    }
    @MainLoop{
		bossX = ObjMove_GetX(objBoss);
		bossY = ObjMove_GetY(objBoss);
        ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32); 
        ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 24);
        if(count % 100 == 0){
            fire;
        }
        count++;
        yield;
    }
    task fire{
		wait(100);
        if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0){return;}
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 282, 1, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 298, 9, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 314, 17, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 330, 25, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 346, 33, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 2, 41, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 18, 49, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 34, 57, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 50, 65, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 66, 73, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 82, 81, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 98, 89, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 114, 97, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 130, 105, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 146, 113, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 162, 121, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 178, 129, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 194, 137, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 210, 145, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 226, 153, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 242, 162, 9);
		CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, 258, 165, 9);
		SE_Play(cus,60);
    }
	task BossMove{
		let dir;
		let speed;
		while(!Obj_IsDeleted(objBoss)) {
		dir = ObjMove_GetAngle(objBoss);
		speed = ObjMove_GetSpeed(objBoss);
		if(speed == 0) { ObjSprite2D_SetSourceRect(objBoss,0,0,20,49); }
		else if(cos(dir) < 0) { ObjSprite2D_SetSourceRect(objBoss,20,0,0,49); }
		else if(cos(dir) > 0) { ObjSprite2D_SetSourceRect(objBoss,0,0,20,49); }
		yield;
	}
	}
	task BossReallyMove{
		wait(180);
		loop { 
		ObjMove_SetDestAtSpeed(objBoss,100,120,3);
		wait(100);
		ObjMove_SetDestAtSpeed(objBoss,280,120,3);
		wait(100);
	}
	}
	task Aura {
	let frameAura = 0;
	let objAura = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(objAura, GetCurrentScriptDirectory~"./img/spellcircle.png");
	ObjSprite2D_SetSourceRect(objAura,0, 0, 132, 132);
	ObjRender_SetScaleXYZ(objAura,1,1,1);
	Obj_SetRenderPriorityI(objAura,25);
	ObjSprite2D_SetDestCenter(objAura);
	ObjRender_SetBlendType(objAura,BLEND_ADD_ARGB);
	ObjRender_SetPosition(objAura,ObjMove_GetX(objBoss),ObjMove_GetY(objBoss),0);
	ObjRender_SetAngleXYZ(objAura,0,0,0);
	while(!Obj_IsDeleted(objBoss)){
		frameAura++;
		ObjRender_SetScaleXYZ(objAura,1.5+0.2*cos(frameAura*1.5),1.5+0.2*cos(frameAura*1.5),1);
		ObjRender_SetAngleXYZ(objAura,0,0,frameAura*1.5);
		ObjRender_SetAlpha(objAura,205-50*cos(frameAura*1.5));
		ObjRender_SetPosition(objAura,ObjMove_GetX(objBoss),ObjMove_GetY(objBoss),0);
		yield;
	}
	Obj_Delete(objAura);
}
    task TFinalize {
        while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
		TExplosionA(bossX,bossY,10,0.5);
        Obj_Delete(objBoss);
        DeleteShotAll(TYPE_ALL, TYPE_ITEM);
        SetAutoDeleteObject(true);
        CloseScript(GetOwnScriptID());
        return;
    }