How do I have solids not affecting the enemies line of sight?

0 favourites
  • 11 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • In this rpg game my player has a choice to travel up and around vehicle objects to get away from the enemy. However the vehicle objects each have a solid box on top of them to stop sprites passing through (works a treat), and unfortunately it stops sprites from seeing whats behind (greater y axis in this case) the cars.

    Is there anyway to bypass this and somehow have the enemies walking around the boxes, instead of them just stopping and returning to their paths as soon as the player runs behind them?

    I have included an image in this link: ibb.co/dBrmL3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Solids are obstacles by default, you can change Solids to 'Custom' on the LOS behaviour then the Solids will not act as a wall for the LOS.

  • When I switch them to custom, the obstacles arent stopping sprites from walking through them since they're not solid anymore. Is there a way for the enemies to walk around the obstacles whilst chasing the player, and for the obstacles to remain solid?

  • The pathfinding behaviour should still be detecting solid as obstacles and walking around them, I don't see why that would change.

  • Because they're not solid anymore, theyre custom. They're no longer classed as solids and the sprites just walk through. Also the enemy isnt using pathfinder to chase the player, it's used to set the enemies movement before it sees the player through LOS. Is there a way around this problem?

    screenshot of my enemy events: ibb.co/P1R2ckd

  • Not sure what you mean, an object cannot be custom. The obstacles mentioned should be solid. I said to set the line of sight behaviour to detect custom obstacles instead of solids, this removes the solids as obstacles and the enemy can then see through them.

  • I meant the obstacles are solid but I set the LOS for the enemy sprite to Obstacles: Custom in the properties panel (image link below).

    ibb.co/tb8NR3y

    The enemies still walk over these solid obstacles as if they weren't there and I need the enemies to walk around them whilst pursuing the player, not through them.

  • In your original post you said the problem was seeing them with LOS through solid objects. You said the walking around them (pathfinding behaviour) is working as expected, I don't see why this would change now. If the pathfinding behaviour has obstacles set to solid then it will set a path around those obstacles.

  • I said the solids are working for stopping things from passing through, but that's a separate matter. Yes, the problem is the LOS and that the enemy cant see the player behind the solids. I want the enemy to see what's behind the solids but to not walk through them whilst LOS is active. I want the enemy to follow what's hidden behind these solids but to travel around them.

    The enemies pathfinding has nothing to do with chasing the player, only when LOS is lost will the enemy go back to its initial path.

    When the obstacles are solid (in LOS panel), the enemy stops and turns around as he loses sight. I dont want this.

    When the obstacles are custom, the enemy walks through the obstacles as he chases the player. I also dont want this.

    I want the enemy to, when approaching the obstacles on persuing the player,take a different route around the obstacles instead of stopping and returning to initial position.

    The vehicle objects the player 'runs behind', aren't to look tall enough to hide the player, hence why the enemy should still be able to see him and pursue him.

  • It's because you're using move to direct which doesn't take into account any solids. You should continue using pathfinding and find a path to the player, not move to. Although there is a pathfinding action under move to which might work but I've never tried it, it's fairly new.

  • Ok thanks for the help! The pathfinding sounds like it could work will try that :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)