Point inside object action

How would you make it so that for each instance of an object A, if its point is in collision with object B it will delete object A?

Using a Repeat for each ObjectA loop, check whether the point is inside object B (I’ve added a new point on object A called testPoint) :

I have now come across a different issue where the inverted version of the point inside object action isn’t working.

I have boxes with points “DownLeftPoint” and “DownRightPoint”

I have the object group “Platforms”

And this code, that should only delete a box when both points are not in collision with any platforms:

I run the preview

and when I press c, they are all deleted

I suspect what’s happening here is that although the each box point is within the platform directly under it, it’s also not within the other platforms. So the conditions are true.

I’d suggest using a boolean (say called deleteBox) and setting it to true at the start of the repeat for each box. Then have a subevent of the Repeat block, with an OR conditions that check whether one of the points are in a platform and setting deleteBox to false as the action.

Then have another event after that subevent that deletes the box if the boolean variable deleteBox is true.

1 Like

Correction, inverting a condition checks if any object doesn’t meet the condition, not if all are not meeting it. To check if the point is not inside any Platform (instead of checking if any platform does not have the point inside of it) use the not event, though it is broken with a few conditions including the “point inside of object” condition. I’ve submitted a fix already, but it still needs to be merged and the next version to be released after that:

In the meantime, you can, as MrMen suggested, use a boolean variable to do that manually:

1 Like