Line of sight not working

For questions about using Classic.

Post » Sun Apr 26, 2009 10:54 pm

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.
B
8
S
3
G
5
Posts: 72
Reputation: 1,774

Post » Sun Apr 26, 2009 11:13 pm

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. :mrgreen:
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Wed May 06, 2009 12:24 am

*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.
B
8
S
3
G
5
Posts: 72
Reputation: 1,774

Post » Wed May 06, 2009 2:51 am

post a .cap so we can have a look :)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Wed May 06, 2009 10:19 am

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...
B
8
S
3
G
5
Posts: 72
Reputation: 1,774

Post » Wed May 06, 2009 2:35 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Wed Jul 22, 2009 5:43 pm

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. :(
B
2
S
2
G
4
Posts: 124
Reputation: 1,698


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests