Wake enemies when they are in view?

For questions about using Classic.

Post » Thu Jul 05, 2012 3:19 pm

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?
Posts: 38
Reputation: 676

Post » Thu Jul 05, 2012 6:35 pm

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.

Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
Posts: 2,246
Reputation: 20,754

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests