In the screenshot, i want to change the background color depending on the mouse is over the sprite or not.
When the mouse is over the sprite, the color should change to black, if it is not then it should be white.
However, both expressions get executed (what means both are true at the same time), what results in the background stays white all the time.
But how can be both statements true at the same time when they check for their corresponding opposite case?
Is there multiple instances of Sprite object in the scene?
If yes, that’s how For one its true and for other its false and GDevelop get confused which one you refer to.
It is a common problem with the way GDevelop handle objects.
In similar cases you can try to use either For each event to loop through each instance one by one, the NOT operator instead of reversing the condition and object variables to flag objects that you refer to depends on the use case and circumstances.
For selecting objects, an example is included with GDevelop called “Object Selection”. Take a look.
I have multiple instances and was not looping through them. With a “not” expression it is working. Was expecting that both are doing the same (the button to negate an expression, and the not operator)
I really like GD but the more im working with it, the more im getting confused
Why is there no “ELSE”-statement? If i want the game behave differently if a condition is met and not met, and the condition is really complicated, its kind of awkward to create an “opposite” condition to act like an “ELSE” block.
Other thing is, are these 3 situations producing the exact same result?
The “Repeat for each Card_Slot object” loop (red marked box) does not even start (background doesnt change) even though there are Card_Slot objects in the scene… . The statement right above this one (smaller green box) gets executed though .
The “Repeat for each Card_Slot object” in the big green box on the top gets executed and work fine however.
I dont get it… nothing has changed the “Card_Slots” in the meantime…
Why does the above loop run fine and the bottom doesnt even start…?
Im a software developer for over a decade… but GDevelope is really complicated to me