Turret - Line of Sight

0 favourites
  • 10 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Hello Gamers,

    Question, How can I make my turret behaviors only acquire a new target if the target is in line of sight. For example I have two targets same distance from the turret. One is in sight and one is behind a solid. The Turret should not acquire the one behind a solid but it should acquire the one that's in line of sight. How can I accomplish this?

    Thank you,

  • I have the same problem. Turret is trying to shoot to nearest target despite it is behind the wall. Maybe Scirra developers should add obstacles to behaviors of turret?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just add 'line of sight' behaviour as well as Turret.

  • Just add 'line of sight' behaviour as well as Turret.

    If turret see in line of sight several targets, and one of them is hiding behind the wall and is nearest to the turret, turret will still shoot at it. It will be good if turret in that case just switch to another target.

  • I did something similar once. When my Turret acquired a target, I would check if there was also line-of-sight.. if yes, then I would fire a bullet using 'spawn sprite', not 'Turret:On Shoot'. I'm sure I had a reason for doing it that way.. but maybe you could just put a line-of-sight check in the On Shoot event.

  • I did something similar once. When my Turret acquired a target, I would check if there was also line-of-sight.. if yes, then I would fire a bullet using 'spawn sprite', not 'Turret:On Shoot'. I'm sure I had a reason for doing it that way.. but maybe you could just put a line-of-sight check in the On Shoot event.

    Thank you a lot, i will try both ways

  • Here is capx: https://www.dropbox.com/s/8xa3g6gtc1cr3 ... emies.capx

    I do not have any idea how to make this workable )

  • Your best bet is to use manual target acquisition. Here's your capx modified so your turret acquires the closest target in its line of sight.

  • Your best bet is to use manual target acquisition. Here's your capx modified so your turret acquires the closest target in its line of sight.

    You are genius!

  • it is good

    turrent can't shoot player behind wall

    here's the file

    tusfiles.net/1xxk3e567cwc

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