#TouhouDanmakufu[Single] #ScriptVersion[3] #Title["SampleB02"] #Text["SampleB02: ObjPatternShot Transforms 1"] #include "script/default_system/Default_ShotConst.txt" let objEnemy; let frame = 0; @Event { alternative(GetEventType()) case(EV_REQUEST_LIFE) { SetScriptResult(500); } } @Initialize { objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS); ObjEnemy_Regist(objEnemy); let imgExRumia = GetCurrentScriptDirectory ~ "ExRumia.png"; ObjPrim_SetTexture(objEnemy, imgExRumia); ObjSprite2D_SetSourceRect(objEnemy, 64, 1, 127, 64); ObjSprite2D_SetDestCenter(objEnemy); let cx = GetStgFrameWidth() / 2; ObjMove_SetDestAtFrame(objEnemy, cx, 120, 60); TShot(); } @MainLoop { let ex = ObjMove_GetX(objEnemy); let ey = ObjMove_GetY(objEnemy); ObjEnemy_SetIntersectionCircleToShot(objEnemy, ex, ey, 32); ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey, 24); yield; if (ObjEnemy_GetInfo(objEnemy, INFO_LIFE) <= 0) { Obj_Delete(objEnemy); CloseScript(GetOwnScriptID()); return; } } task TShot() { let objPattern = ObjPatternShot_Create(); ObjPatternShot_SetParentObject(objPattern, objEnemy); ObjPatternShot_SetPatternType(objPattern, PATTERN_ARROW); ObjPatternShot_SetDelay(objPattern, 12); ObjPatternShot_SetGraphic(objPattern, DS_SCALE_BLUE); ObjPatternShot_SetSpeed(objPattern, 1.5, 1.2); ObjPatternShot_SetShotCount(objPattern, 3, 5); ObjPatternShot_AddTransform(objPattern, TRANSFORM_WAIT, 20); ObjPatternShot_AddTransform(objPattern, TRANSFORM_ADD_SPEED_ANGLE, 900, 0, 0.015, 0); ObjPatternShot_SetShootRadius(objPattern, 32); wait(60); let frame = 0; while (ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0) { ObjPatternShot_SetAngle(objPattern, rand(0, 360), 6); let ang_vel = 6.4 * sin(frame * 8); ObjPatternShot_SetTransform(objPattern, 2, TRANSFORM_ANGULAR_MOVE, 30, ang_vel, 2); ObjPatternShot_Fire(objPattern); frame++; wait(10); } }