Line of sight not working

This forum is currently in read-only mode.
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • I'm playing around with the line of sight behavior to see how it works.

    As a test in order to get an idea for how the range would be detected I setup an object inside my game that changes animation when the player is within range using "Has LOS to (player)" and changes back when the player's out of range. I set a 250 pixel range at 10 pixel accuracy.

    However... it doesn't seem to actually listen to what you set the range as.

    For instance, at 10 pixel accuracy the animation only triggers if you're standing within 10 pixels of the object, even though the range is 250 pixels. If I change the accuracy to 100 pixels, then it will activate within 100 pixels, but not the 250.

    I was about to make an example to put up here to demonstrate the problem, but oddly it works fine when you make a new file with it in there... but not in my game itself. No idea why it won't work in my game.

  • it might be an event which does something that affects it, but you just havent realized it. I always run into "my game" specific problems. My best advice would be to look carefully over all of your events and make sure you're not doing something unwanted. It might also be a bug, but be wary of how your events are set up. I frequently think things are bugs only to find out that some little expression is returning 0 (or something like that), and the bug is actually my fault. Run the debugger if you havent, it helps me fix bugs like this often.

  • *bump because I'm late*

    Well, I'm not really sure how prior-existing events could do this. The "enemy" objects in question had no events before I added the check for LOS as a test, and they still don't have any apart from those, and I can't see anything that would affect the player object in such a way as to completely break how it reacts to the LOS behavior-- does anyone know of some that might?

    It may also be interesting to note that if i change the object the enemies are looking for, LOS doesn't work with them either.

  • post a .cap so we can have a look

  • Issue: Working on what potentially could end up being a commercial project, and the problem ONLY happens in that *.cap. A new example doesn't have that problem...

  • Then something else in your .cap is causing the problem. Back it up and strip everything away until you have an empty .cap with just the problem. If it stops doing it half way through removing everything, one of the last things you deleted was causing the problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm guessing your hotspot is set somewhere (like at the feet of a sidescrolling platformer character)

    I had the same problem, but then realized the "invisible particles" for LOS detection are likely spawned from the hot spot and were therefore immediately getting destroyed (becasue the hotspot is touching a solid object.. IE, as soon as the invisible detection particle gets spawned, it gets destroyed!)

    I moved the hotspot up to where the eyes would be inthe sprite and it now works fine.

    is this the case for you as well?

    I wish we could set the origin point or "eyes" to another point.

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