Hello Dear,
Can you help me?
How can I select an object by its name plus a number variable?
Let me explain:
support1, support2, support3, etc.
I’m running a loop and want to use a number variable that increases with each pass. So, I’d like to select the ‘support’ + the number (concatenation).
Do you have any ideas?
Many Thanks in advance.
If you put something in quotes, it literally gets taken as that string and not evaluated. So this:
is just the string/text “ObjectGroup.ObjectName()”, not what it evaluates to, because it is surrounded by quotes. To GDevelop, it’s similar to “Hello World” in that it is just a string/text. To GDevelop it is just text and nothing else.
ObjectName() is a function that returns the name of the object. If that object is a group, then it returns the name of that group object. You need to replace “ObjectGroup.ObjectName()” with grpPlaceholder.ObjectName()
For the action, “.X()” and “.CursorY()” needs to be on an object, not the string name of an object. In that loop, the object is represented by grpPlaceholder. So this:
Hey i have a problem in the code like you have. Lets say i have multiple instances of the object House. They are all belong the group called Tiles. Every created instance of a House has a Value and Index. Index is like ID for every created House. So when i lets say press button i want to calculate every Value of every house one by one. So i did:
And it works only for the first house. CurrentIncomeIndex changes to 2 and thats it. How can do calculations and animations for every object of a group “one by one”?
The house objects may not be iterated over in order of Index. Say you have 5 house objects. If the first one has an index of 5, the second one an index of 4, the third 3, the fourth 2 and the fifth house has an index of 1, then it only works on the last house.
The CurrentIncomeIndex is actually redundant in those events. Just take it out of the conditions and actions.
My question would be why do you need to check the grpPlaceholder’s name? It’s not like a specific card is placed on it. Remove the condition checking the grpPlaceholder name and also remove the action incrementing holdernum. They are both unnecessary.
Also, you could be picking a card that is already moving. You need to add the condition that the Card object does not have the tween “FlyIn”.