#TouhouDanmakufu[Single] #ScriptVersion[3] #Title["Lilly 1"] #Text["Lilly's First Nonspell"] let bossObj; let bossX = 0; let bossY = 0; let imgBoss = GetCurrentScriptDirectory ~ "/img/Placeholder.png"; #include "script/default_system/Default_ShotConst.txt" //My bffl <3 function wait(w) { loop(w) {yield;} } @Initialize { //define a boss in bossObj and register bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS); ObjEnemy_Regist(bossObj); ObjMove_SetPosition(bossObj, 192, -100); ObjMove_SetDestAtSpeed(bossObj, 192, 170, 5); mainTask; die; } @Event { //setting boss hp and shenanigans alternative(GetEventType()) case(EV_REQUEST_LIFE) { SetScriptResult(1500); } case(EV_REQUEST_TIMER) { SetScriptResult(40); } } @MainLoop { bossX = ObjMove_GetX(bossObj); bossY =ObjMove_GetY(bossObj); //collision ObjEnemy_SetIntersectionCircleToShot(bossObj, bossX, bossY, 18); ObjEnemy_SetIntersectionCircleToPlayer(bossObj, bossX, bossY, 25); yield; } @Finalize { } task mainTask { renderBoss; movement; } task renderBoss { let dir; let speed; ObjPrim_SetTexture(bossObj, imgBoss); ObjSprite2D_SetSourceRect(bossObj, 0, 0, 63, 116); ObjSprite2D_SetDestCenter(bossObj); ObjRender_SetScaleXYZ(bossObj, 1, 1, 0); while(!Obj_IsDeleted(bossObj)) { //update speed and direction dir = ObjMove_GetAngle(bossObj); speed = ObjMove_GetSpeed(bossObj); yield; } } //i feel like cirno right now ;~; task movement { wait(60); loop{ ObjMove_SetDestAtSpeed(bossObj, 100, 120, 4); fire; wait(90); ObjMove_SetDestAtSpeed(bossObj, 280, 120, 4); fire; wait(90); } } task fire { loop(round(rand(10, 30))) { CreateShotA1(bossX, bossY, 3, GetAngleToPlayer(bossObj) - 20, 54, 0); CreateShotA1(bossX, bossY, 3, GetAngleToPlayer(bossObj), 54, 0); CreateShotA1(bossX, bossY, 3, GetAngleToPlayer(bossObj) + 20, 54, 0); wait(3); } } task die{ loop{ if(ObjEnemy_GetInfo(bossObj, INFO_LIFE) <= 0) { //The enemy is killed immediately when life is 0 //As this is a beginner sample script, //the script is ended immediately without waiting for an explosion effect. ObjMove_SetDestAtSpeed(bossObj, 200, 200, 4); DeleteShotAll(TYPE_ALL, TYPE_ITEM); Obj_Delete(bossObj); DeleteShotAll(TYPE_ALL, TYPE_ITEM); CloseScript(GetOwnScriptID()); return; } yield; } }