[SOLVED] Problem with a Condition Function

Hi, I want to change the animation of a Sprite when a Boolean of his behavior change (because you can’t do it in an Action Function): If it’s True the object need to have the Animation 1 and if False the number 0.

This, in the Event of the Scene, work ok:


Area_Ice is a sprite and BrickGroup is a Group of Sprite

But, this, don’t and I don’t understand why:
immagine_2021-02-14_001118
The boolean change but the event condition doesn’t see it.
It doesn’t work even if I change “BrickGroup” with a single Sprite of that Group.

“Set BrickGroup as Iced” is the Action that set the Boolean:

And “Is BrickGroup Iced?” is this Condition:


“IsIcedOrNot” is the boolean property already edited in the behavior editor.

I know that there are other ways to work around it but I want to understand how to work with GDevelop and what I can (or can’t) do with it; so, If someone understand what I’ve done wrong, just tell me, please.

I think if you pass a Group to a Function you need to create a Group inside the Function too. Not sure but you can try.

1 Like

I haven’t tried but It doesn’t work even if I use a single Sprite instead of “BrickGroup”.

Other way to do this is to add an Object variable to the brick sprites then check in a Foreach if that variable is 0/1
Foreach BrickGroup
— if brick.variable(obj_var_is_iced) = 0
Do something…
Maybe cahnge the sprite animation to frozen or something…

Foreach BrickGroup
---- if brick.variable(obj_var_is_iced) = 1
Do smething…
Maybe add a timer to defrost the bricks.,

1 Like

Yes, thanks, good idea… bur I wanted to know if I can use the boolean property of a behavior that way or not!
Maybe not…

Solved! The problem was in the second event of this:

It would overwrite the True Condition returning a False and so it sohuld be moved up… before the property check.

What a stupid thing that I have done…

Sorry for the loss of time!