How to check if the cursor is not colliding with an object

Context

I am working on a tile based RPG, and am looking to create a function where holding down the middle mouse button lets me check the distance, in tiles, of two points.

What Happens

If I apply the collision check, then pressing the middle mouse button appears to do nothing. If I remove the check, then the action runs once per frame and overplaces highlight tiles and counters, as expected.

you are setting the text of count_distance before creating it. is this intended? if not, the text object will spawn with default text (which normally is just “text”).


keep in mind that its possible to check the distance automatically without dragging the mouse at all (i.e. in one frame). by keeping the info of adjacent tiles for each tiles Details - GDevelop documentation



perhaps try this?


yep ok, i did some tests and it turns out that inverting cursor/touch is on object cannot trigger unless there is at least one object on the scene. (i.e. it tries to find at least one object where the cursor isn’t on). however, if you start with one object on the scene, it will always trigger true, because there is at least one object where the cursor isn’t on (even if the cursor is on something).

a not prevents all of that and invert the entire logic instead.

keep in mind that the “(j) invert” does not invert the logic completely, it tries to find an object where the condition is not met. here is a more comprehensible explanation: https://www.youtube.com/watch?v=aQQQ8ZgIHf4&t=22s