Get all the objects of the group at a distance

How do I get a list of instances of objects that are within a radius of 100 pixels from the player?
Instances have variables, I need to get them too…

Use the condition “Distance between two objects” on player, and use the group as the other object, then you’ll get all the objects of the group that meet the criteria. The you can use a subevent to iterate through each object of the group.

The first condition will reduce the list of group object to those that fit the criteria. The subevent only works on the reduced list, not all of the objects of the group.

1 Like

As @MrMen says you can compare the distance like this

Note the condition is inverted to test if the enemy is 1 pixel of the player you need to adjust that 1 to 100

No need to invert the condition. Inverting changes the condition to “distance to object is not less than”, where as the OP wants it within (i.e less than) a set radius.

1 Like

Here’s how I did it in the end:

When my player approaches an object, he gets their variables.
This also works with different objects in the group.

1 Like