Line of Sight Behavior as Tripwire

  • I'm trying to use the line of sight behavior to alert a sprite when it is within a certain distance of another sprite. Unfortunately I cannot get it to work.

    I am currently using "System-For Each" to cycle through every instance of an object. I am then checking to see if that object has line of sight to a family of other objects. If it does, both object are destroyed.

    The Obstacles setting for the object with the line of sight behavior is set to "Custom", but I haven't seen a difference between that and selecting "Solids".

    My project is at an impasse until I get this figured out, so any help would be greatly appreciated.

  • check this .capx =)

    here is my original post about this in case you want to check it out

    here is a way to manage the picking beetween instances

  • Thanks for the quick reply. Unfortunately, I'm unable to open your capx. Construct is saying that your file is from version 164.2 while I'm using 163. I purchased via Steam, so maybe that has something to do with it. I'm sure I'll get upgraded at some point.

    Maybe you can answer a question for me though. Is LOS layer dependent; will it work for objects that are on different layers?

    Also, here is a screenshot of the code I'm currently using:

    Do you see anything obviously wrong about it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the quick reply. Unfortunately, I'm unable to open your capx. Construct is saying that your file is from version 164.2 while I'm using 163. I purchased via Steam, so maybe that has something to do with it. I'm sure I'll get upgraded at some point.

    Maybe you can answer a question for me though. Is LOS layer dependent; will it work for objects that are on different layers?

    Also, here is a screenshot of the code I'm currently using:

    Do you see anything obviously wrong about it?

    try installing the beta of construct... go to steam, go to construct rigth clikc and in properties, go to betas and set it like you want to use beta versions... its really hard to tell just from 1 image...

    either

    installl c2 beta to open my example or post a .capx to check it out...

  • No luck installing the Beta from Steam; it is requesting an access code.

    Also, no luck in uploading an attachment. However, I was able to put it on my Dropbox at The line of sight code that I'm trying to use is on line 93 of the "Level Play Event Sheet"

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