Help with the proximity behavior

Ok, so I’m trying to use the proximity behavior to create a Line of Sight lighting effect by increasing the X size of my “flashlight” object to extend to the nearest wall and then getting the positions of the “darkness” blocks that are in a certain proximity of this flashlight object (ideally returning all of the blocks that the object is touching as it extends), but no matter where I move the flashlight object to, the proximity only returns the value of one darkness block total, even if I move the flashlight far away from that specific object (far outside of the proximity, which is only 16), it still just returns that specific object. It’s a random one each time and I don’t know how to fix it.
Here is the faulty code (I can’t get a screenshot of it in action, but that proximity in the bottom left always outputs the same value for some reason)

Link to the game:

Any help is greatly appreciated! :slight_smile:

2 Likes

Ok can you summarize you entire paragraph into 1 sentence im having a hard time trying to focus on what your asking. Don’t say anything about the flashlight stuff just say what you need the proximity to do.

3 Likes

I need the proximity to output all of the “darkness” blocks that are touching my extendable light source, but for some reason the output is the same every time, even if that specific block isn’t even nearby.

Change the first object found to all objects found

2 Likes

Oh, so that’s only like that at the moment because having it output all objects causes extreme lag (one problem at a time, lol) but even using that it still doesn’t change the outputted blocks when you move around, it just continues to output a couple of specific blocks that don’t change no matter where you move

1 Like

Oh

What do you mean by output all of your darkness blocks, is the proximity suppose to detect all of the darkness blocks or something?

1 Like

So the idea is that the flashlight would extend to the nearest wall and that all of the darkness blocks that the flashlight intersects/touches would be output, but it isn’t even outputting a block that the flashlight is even touching. It’s just outputting a random block each time

Yeah the proximity doesn’t work like that, It doesn’t output everything it touches it only outputs if it touches somthing.

1 Like

Perhaps connect the x and y proximity outputs to the “push” input of 2 list behaviors; the list it builds will have all the coordinates you need

1 Like

It outputs the coordinates

1 Like

So, I know that it outputs the coordinates, but if you look, you will see that it always outputs the SAME coordinates, no matter where you move.

Doing this actually shows the issue better than I could explain it
Screenshot 2022-02-22 1.11.47 PM
Despite the fact that I was moving all around the maze, it still just outputs only that one point, and I don’t know why

Flowlab Game Creator - Proximity Count Example Does this help at all?

2 Likes

Oh wait, do the blocks you’re checking for have code in them?
If they don’t then Flowlab might be merging their collision boxes, in which case I think that makes them all have the same x and y (but I may be wrong).
If they do have code then it’s probably a different issue in which case I have no idea what’s going on

2 Likes

They definitely do have code in them. Is it possible that this is actually a bug?

/summon the bois
@JR01 @TinkerSmith @Samuel_PixelPizza

1 Like

/summon the impending doom
@grazer

1 Like

What are you trying to do exactly?

2 Likes

So you have to select “output all objects found” like HeadlessHorseman mentioned earlier, I just tried it and it builds the lists fine

2 Likes