I’m sure the answer to this is very simple, but for some reason, I’m just not getting the “Repeat for each … object”. Sure I could do this with 4 actions, but I’m trying to learn the nuances of GDevelop.
Scenario: 4 radio buttons on screen. When user clicks on one, its animation is changed to name “select” and all other radio button animations are set to name “unselect”.
Set up:
There is one sprite named challangeSelectDot with 4 instances. Each instance has a variable (ID) set to the number of the button (so I know which one the user clicked on).
I created an extension (PARAM1 named dotClicked is passed the challangeSelectDot the mouse is on when clicked):
Events:
Variable ID of dotClicked = 1 Set animation of dotClicked = “select”
Variable ID of dotClicked = 2 Set animation of dotClicked = “select”
Variable ID of dotClicked = 3 Set animation of dotClicked = “select”
Variable ID of dotClicked = 4 Set animation of dotClicked = “select”
In the main Events window:
Touch or left mouse is down
cursor /touch is on challangeSelectDot
Repeat for each challangeSelectDot object Set animation of challangeSelectDot to “unselect”
(no condition) Call extension using challangeSelectDot
Results:
- the animation change to “select” works
- the animation change (using For Each) does not work, so on the second click, the first button clicked still shows selected.
Can someone tell me why this is misbehaving?
Thanks
Art.