Multiple Enemies with different Lines of Sight?

0 favourites
  • 2 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hello. So I'm a bit of a noob when it comes to construct 3 but I'm learning quick. However, I've run into a big issue with my game. I have an enemy (Goblin), that has been programmed to follow the player based on it's LOS. I copied and pasted the Goblin so I could have multiple Goblins attacking the player, but here's the issue. When I run into one's LOS, they all move the same way, all jump at the same time, and all mimic each other. Any way to add separate Lines of Sight to each Goblin Copy? Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you use "Enemy has LOS to player" condition, this picks all enemy instances that have LOS. For example, if you have 10 enemies, this event can pick 2 of them. Everything you do inside this event, will only apply to those 2 picked instances. So you can tell them to chase the player, using Pathfinding behavior for example.

    You can add another (inverted) event "Enemy does NOT have LOS to player", this event will pick the remaining 8 enemy instances. You can stop their movement, or something like that.

    It's a good idea to define an instance variable on the enemy, for example, State. For chasing enemies set State="chasing", for other set State="patrolling", this will give you more control and allow you to distinguish them in other events. So your code can be something like this:

    Enemy has LOS to player
    Enemy State="patrolling"
    	Enemy set State="chasing"
    	Enemy find path to player
    Enemy on path found 
    	Enemy move alone path
    Enemy does NOT have LOS to player
    Enemy State="chasing"
    	Enemy set State="patrolling"
    	Enemy Pathfinding Stop
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)