To be or NOT to b...invert!


Screenshot 2026-01-20 164541

Could someone who’s smarter than me, please tell me why when the engine tells me NOT to use a NOT condition, just to invert the condition… But doing this in many situations does NOT work… :slight_smile: NOT Good…

2 Likes

It took me awhile to understand inverted conditions vs NOT.

Say you have 10 objects and the cursor is on 1 object.

Cursor is on object selects 1 object and triggers any events

Inverted Cursor is on object selects 9 objects and triggers any events

The only way inverted Cursor is on object wouldn’t trigger something is if there was only 1 object or if the object’s were stacked and the cursor was on all of the instances.

NOT Cursor is on object
This inverts the result not the condition. That sounds the same but it’s different. It works sort of like an all instances instead of any instance. It only takes 1 object to make a condition true.

If the result is true the NOT makes it false and vice versa.

NOT Cursor is on object

If there are any objects under the cursor it returns true but the NOT condition inverts it so it’s false and nothing gets triggered.

If there aren’t any instances with a cursor on it, it would evaluate as false but the NOT flips or inverts the result making it true and triggers any other events.

The thing to remember is since no objects met the cursor condition. No objects get picked. The actions or other conditions get processed but if the object being tested is used afterwards then you would need to use pick all objects to repick the objects. You may need additional conditions if you don’t want all of the instances used.

Depending on your needs, putting an inverted Cursor is on object inside of a for each object would also work because it’s testing only 1 instance at a time. So, it would be either true or false according to that 1 instance.

So, for the 10 instances it would be true 9 times and false once.

3 Likes

Thank you Keith, great answer :slight_smile:

2 Likes

I’m curious is this a gdevelop quirk or just how development is?? Either way i tried NOT, inverting all combinations and then a ‘for each object’ I just couldnt get it to work so i just reverted to listing out all the objects individually rather than a group. Oh well… :frowning:

It’s a bit unique because the statements don’t just return true or false like most comparators. It also picks the matching objects. So, this gives you a mixed result. It can be true or false for all or some instances. If it’s true for just 1 instance, it returns true. It’s not true for the object but for the instances.

Usually something is only true or false but for an object with instances. It can be both true and false for some of the objects.

It just depends on what you want to do. If you’re targeting the objects then you might not need to use NOT but if you want to know if they’re all either true or false you might need the NOT condition.

It’s the instances part. If you’re just targeting 1 object then it will be true or false but with instances it can be sort of true and false at the same time so a regular and inverted condition would both return true. Usually, something can only be true or false. It can only be visible or invisible. But this can check multiple objects and instances.

I’m used to the individual checks. Like “is this button visible” not “are any of these buttons visible”

1 Like