MrMen
February 24, 2020, 11:30am
1
Is there a way to go through all objects in a layer, and change the current animation of each object in that layer?
For example, if Layer1 had sprite1, sprite2 and sprite3, I’d like to iterate through all 3 sprites and change their current animation.
How can this be done in GDevelop?
Bouh
February 24, 2020, 11:40am
2
For each ObjectA
If ObjectA is on layer X
then all objects ObjectA in actions will be the objects ObjectA present on layer X
More about how Events and how objects are selected by these Events
MrMen
February 24, 2020, 11:58am
3
So pretty much I’ve got to check each object by name and whether it exists on the layer. I can’t just get a list of sprite objects in that layer?
i.e., I’ll have to have 3 conditions for the 3 sprite example in my initial post:
for each Sprite1
if sprite1 is on layer1 ....
for each Sprite2
if sprite2 is on layer1 ....
for each Sprite3
if sprite3 is on layer1 ....
and repeat this for each layer I might have? I’d really like to be able to say :
for each sprite object in layer1 ...
But thinking about it, that’s not the way GDevelop works
Bouh
February 24, 2020, 1:32pm
4
For avoid to repeat 3 times the loop for each objects, use the groups, put all your objects Sprite 1 2 3, in this new group and use the group, For each YourGroup