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?
B
2
G
1
Posts: 38
Reputation: 526

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.

CustomLOS
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests