I'm trying to make my game run better on less powerful systems and would love to hear some tips on how to approach this.
I have multiple objects / enemies with mostly simple movement behaviors (sine, LiteTween) that I would like to toggle off when player character is not in their immediate vicinity. Then when player is near them, I'd like to toggle the movement back on (and of course make all this work so that player never notices any difference .. except hopefully better framerate:).
I tried using "is on-screen" / "not on-screen" in events for this and it works somewhat, but not exactly as I'd like. If the object / enemy is right outside the screen (but still very near) it also stops moving and never comes to view again unless player moves, and I would like to find a better solution to this.
Ideas that come to mind are using something like line of sight, checking for distance between player and the object(s) or using invisible detector sprite pinned to the player to check for overlap with enemy objects and activating when overlapping. However, I don't really have any idea on how much of a performance hit each of these methods are and what is the best approach to try.
I'd like to improve the performance instead of making it worse, so would love to hear ideas on efficient ways to do this. Thanks for any help!