[SOLVED NOT A BUG] (inverted) Cursor/Touch is object from a group

I made custom cursor object to follow actual mouse cursor
Which is working fine

I have group of objects called soldiers which well include soldiers objects

I made event for changing to selection animation to 1 for that custom made cursor if cursor/touch is on soldiers (not on object soldier but on group soldiers)

Then copied that event inverted cursor/touch is on soldiers condition and changed animation to 0 in action

Just to be clear i tested all combinations of trigger once
Issue is that cursor animation will change if i hover cursor over any soldier from soldiers group but won’t change back if i move cursor away from soldier object

Right now in my project i have only 3 soldiers on scene
And no matter from which i take off cursor it won’t change

But i found out that if they all go to 1 spot overlapping themselves
Which looks like there is only one object (which means they are all in same spot)
And i move cursor away from them then cursor animation will change back

My assumption is that inverted condition of cursor/touch is on object GROUP expect for 1st to be on all objects from that group then only if at the same time cursor is taken away from ALL objects from that group then it will satisfy that condition

You can test it here
After they are all in 1 spot it works perfectly fine both ways
But unless that happens it works only one way (changing from normal cursor to selection cursor when mouse cursor is on any object from that group)

YET i decided to check if same thing happens if i check collision between two objects
Where 1st is that custom made cursor that follow actual mouse cursor
And with object group Soldiers

I disabled Cursor/touch is on object events

And now it works perfectly fine even if i hover over one soldier from soldiers group and move mouse cursor away from it

So my guess there is only problem with this condition when it is inverted as i described above
INVERTED cursor/touch is on object group

This is something that took me awhile to understand. Unfortunately, the documentation is lacking.

Instead of inverting cursor is on put it inside a NOT condition. It sounds the same but it’s not.

Gdevelop doesn’t work in a strict true or false with instances instead it picks the matching objects and triggers the action if the instances are greater than 0 .

So, inverted cursor is on with 4 instances will always return something unless as you said, you stack them and none of the objectsdon’t have the cursor over them.

When you invert a condition, you’re inverting the condition but when you use a NOT you invert the result.

If the cursor is over 1 of 4 instances

cursor is on triggers & picks 1 object

Inverted cursor is on triggers & picks 3 objects

[NOT] cursor is on it would pick 1 and trigger but the not inverts it so it doesn’t trigger

If the cursor is not on any object
[NOT] cursor is on wouldn’t pick anything bc there’s nothing to pick. It would normally not trigger the action but the [NOT] inverts the result and triggers the conditions but without anything picked.

I hope I made some sense.

2 Likes

OMG imagine i explained exact same thing to other user
What is the difference between inverting condition and having that condition do the opposite thing by picking opposite condition

I do not remember what it was
Maybe it was collision or animation but the idea was that it checks initial condition then invert it
And user experienced something similar to what i just did

I just can’t remember what it was
But for sure it was exact same thing you just explained

THX i gonna update title

Also did check with NOT and it works perfectly fine

2 Likes

I know. I did a lot of testing before I understood Gdevelop’s methods and I still have troubles especially when there are multiple scenarios. I should just split the complex scenarios but I don’t like having to use the same actions twice.

1 Like