Store states of many object

I want to select a color (10 different ones), then click on an instance and save the assigned color in a structure-variable.


This works, but I have 400 instead of 3 instances.
How could this work without creating 400 events?

You should be able to just use the repeat condition with a variable that gains + 1 for each loop. Then call that variable for each ID of the sprite? Quick example made on the online editor.

Hm, the problem is addressing the structure variable to fill it.

Yeah, if you could set variables dynamically, then you’d only need one action:

Change the scene variable 'slots.s' + NewSprite.Variable(id): set to Variable(selectedColor)

But I don’t think that’s possible… :confused:

1 Like

Set variable slot["s" + VariableString(loop_num)]

3 Likes

thanks, it works.