How do I stop a turret from shooting a target w/o LOS?

0 favourites
  • 5 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • My units shoot their targets once in range whether there is a solid object blocking LOS (line of sight) or not. Is the turret behavior not integrated with the solid behavior.

    What I want is a unit that has LOS to shoot/look at the target (which I already achieved) and stop shooting/looking at the target when LOS is broken (need to implement).

    Ive already tried implementing it by setting the turret behavior disabled at start and enabled only when LOS is achieved with target. The LOS behavior is set to "obstructions: solids" and Ive already double checked all of the sprites that I want to block the characters' visions are set to solid behavior. Ive also tried looking this up on the forums because I thought it might be a common issue for a lot of people doing a top down game but I cant find anything relevant.

    Thanks for any help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sample capx would make it a lot easier.. but if you have an event to check line of sight (inverted) and then disable turrent behaviour.. it should work I would've thought. I have a combination of LOS and turret behaviour and it works ok. What is your LOS cone of view?

  • Have you tried this?

    [attachment=0:15gnrp10][/attachment:15gnrp10]

    all I have is an object with bullet behavior, an object with turret and los, and a object that is a solid. Works fine for me.

    (*Updated)

  • Sample capx would make it a lot easier.. but if you have an event to check line of sight (inverted) and then disable turrent behaviour.. it should work I would've thought. I have a combination of LOS and turret behaviour and it works ok. What is your LOS cone of view?

    Lol, there I was thinking "man it would be so great if they had a simple way to invert a condition". Didnt even know about the invert option till now, thanks so much you just helped me clean a lot of unnecessary code! + rep again good sir! (let me know if there is some actual way to give + reputation that I dont know of other than the meaningless form of typing it).

  • All good.. there's no upvoting here Do read the manual though!

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