Good way to toggle movements on or off (optimization help)

0 favourites
  • 2 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you want to make something happen based on distance, you can actually use distance(1.X, 1,Y, 2.X, 2.Y) Replace the numbers with the names of your variables. I hope that helped. I'm still pretty new.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)