Wake enemies when they are in view?

This forum is currently in read-only mode.
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template for top-down view games)
  • Thinking about a layout that has many enemy objects trying to hunt down the player. Now, I don't want all of them in the layout to hunt down the player, as there are wall, etc. In fact, I just want these enemies to sleep UNTIL the player moves forward and the enemies are visible on screen. After the enemies are awake, they won't go back to sleep.

    I can think of starting a layout and have all these enemies' private variable "sleep" set to 1. And in every tick, iterate through all these enemies, check them whether they are in the view or not. If they are, set "sleep" to 0. Of course, we will have if (not sleep), follow some event blocks.

    However, in the above paragraph, if I have a lot of enemies, I fear that this may indirectly affect performance a bit. Should I care or should I go for something better in this case?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's a quick example I threw together of a custom LOS system (not based on the buggy LOS behavior). It only works for one player at the moment though.


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