0 Favourites

Wake enemies when they are in view?

This forum is currently in read-only mode.
  • 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?

  • Construct 3

    Buy Construct 3

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

    Buy 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.

    CustomLOS

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Grid based lighting/field of view
65 15,236
elwinalice's avatar
elwinalice
Unread hot topic
41 3,218
Napelazam's avatar
Napelazam
Unread hot topic
32 4,529
niallobrien's avatar
niallobrien