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?