Possible object picking bug with Animation Frame condition

Describe the bug

I think there is a bug with object picking when using the Animation frame condition.

I have two instances of the same Sprite object.

Each instance has a different private variable:

Instance 1: id = 1
Instance 2: id = 2

The condition using the private variable works correctly by itself.

However, when I combine it with the Animation frame = (maxi - 1) condition, only the first instance behaves correctly. The second instance is never picked, even though its animation frame is definitely equal to maxi - 1.

If I remove the Animation frame condition, the second instance is picked correctly (for example, changing its angle works).

I can reproduce the same behavior even without using Repeat for each instance.

Steps to reproduce

  • Create two instances of the same Sprite object.

  • Give them different private variable values (id = 1 and id = 2).

  • Create conditions:

  • Private variable id = 2

  • Animation frame = (maxi - 1)

Execute any action (for example, change the animation frame or rotate the object).

  • The action is never executed for the second instance, although it matches both conditions.

  • Expected behavior

  • The object picking should return the instance that satisfies both conditions (id = 2 and Animation frame = maxi - 1). Instead, the second instance is never picked.

Share a very simple GDevelop project showing the bug

GDevelop version: (
5.6.274 (editor full version: 5.6.274-fbe5427d11406e26a6eb555b2c5b3f527baf594f, core version: 5.6.274-0)
)

I attached a minimal project and screenshots demonstrating the issue. 46KB:

htp://drive.google.com/file/d/1nqCE9IEUVnQHPliQspbsdyS_NTdvuhiw/view?usp=drive_link

Either i did something wrong or i did not understand what you say
And what you call private variables is actually called

:melting_face:

That can’t be correct. The object is correctly picked by its private id, but the condition HeartZero.Mini + 4 (Animation frame) does not seem to be evaluated for the same picked instance.

Both objects have different private id values, and the id condition works correctly. However, changing .Mini, Set frame = 2, or Set frame = 6 makes no difference because the calculated value is the same for both instances.

It looks like the Animation frame condition is not checking the animation frame of the currently picked instance. Instead, it may be checking whether any existing instance matches the frame condition.

As a workaround, I can store the animation state in a private variable and check that variable instead, or use instance variables as suggested. However, I believe the Animation frame condition should work on the currently picked instance.

this is really work and without “for each” :grinning_face:

Are you aware that all your conditions/actions works only when the button is clicked?

No, I think that’s why it still works. Every time I change the animation frame, I also update the object’s private variable.

Also, the “Button clicked” condition is only used as a Trigger once in this example. It becomes true only when the button is released.

So left heart have
ID 1
Mini 1
Frame 1

Right heart have
ID 2
Mini 2
Frame 2

So now it takes their 2nd instance variable to check their current frame

IF THIS is not what you are talking about
Then tell me exactly how to set it up in conditions

It seems that the “Animation frame” condition ignores all previously picked instances and instead checks whether any instance matches the animation frame. Is that correct?

The “any instance exists” behavior doesn’t seem compatible with the AND operator. I would expect the Animation frame condition to be evaluated only on the currently picked instance.

I also noticed that, in GDevelop, the order of events can affect how actions and conditions behave.

Can you post a screenshot of the events that don’t work? If you’re modifying the animation then maybe that’s triggering another event. It would help to see the events that don’t work.

I also noticed that, in GDevelop, the order of events can affect how actions and conditions behave.

It depends on the condition. Conditions work like filters. Each condition can reduce the picklist which the next condition uses. Usually, the order doesn’t matter. But sometimes it does.

It’s like having a bag with red and blue marbles. You could choose a random marble and then check if it’s red. Or you could sort out all of the red marbles and then choose a random one. If you picked a random marble first, the odds of it also being red are lower than picking a random marble from a sorted bag of just the red ones.

On the other hand, say you wanted the small, red marbles. It wouldn’t matter if you checked the size first or the color first. You would end up with the same marbles or maybe none. Either way. The sequence wouldn’t matter in this example.

You gonna start answering questions or you came here just to spread confusion?

Because the longer i read your replies the stronger feeling i get you do not care to learn anything but just throw random BS you think is accurate

And you are wrong and nothing is ignored in my events
Both instances of hearts are targeted by two conditions (with 3 values) and not by one

In A
If 1 is not true
Then all other conditions are not checked

In B
Cause of AND
Does not matter if any condition is not true

ALL of them gonna be checked anyway

That is why you don’t put AND in regular events and use it only inside OR

And since gdevelop reads stuff from top to bottom
In A having 1st condition not true makes it so you can avoid additional conditions checks if the one most important to you is not true

He should remove that Button Extension and test everything with a sprite.

It could be a post-event function in the extension that’s interfering with the logic’s timing.

I don’t know if you’ve already looked at the PanelSpriteButton extension, but if you do, you’ll immediately notice that it takes around 20 pages of events for testing things while in a normal sprite you could just use a boolean…or nothing

I had one sprite, I made 2 copies, it’s just numbers in the animation that I froze at the start, like in Construct, I’m moving because you can’t set the speed to 0 and what do I do next? I just want the frame to change by +1 when pressed and the position to one step down, this is for everyone
but
if the current frame is critical relative to the variable, reset the frame to 0 and raise the position to 0, the upper edge of the screen, that is, I probably didn’t need an ID, just a for condition. Even that doesn’t work correctly, (ONLY BLOCK 2) that is, the second block that raises the picture to the starting point, and only the block that lowers it works, that is, it works for the instance in which the maxi variable is the smallest WHY? This is a simpler block, you will understand here :upside_down_face:

what is your numbs.maxi (maxi) starting value?

no, you defined variable maxi inside numbs.

what is the starting value of variable maxi?

in the original object that is not on stage 0 and in the instances the values ​​are different

and a type number :grinning_face: ok