I'm currently implementing functionality to sell fish in my game Sakawochi. When I enter the selling game state I'd like to display the worth of each fish (independent from it's species) under the corresponding fish instance. To avoid creating a ForEach loop for every fish species I added a group calles "Fishes" and added the fish objects. Each fish species has the same variables: id, size, worth.
Then I loop through the Fishes group and add the UI elements (A group named "Worth_Indicator" consistent of a Coin Sprite and a TextObject for the value) from an external layout to display them underneath each fish object which is working perfectly.
But now I'd like to assign the calculated value of worth*size from the fish objects to the text object inside the "Worth_Indicator" group.
My problem is how can I access the variables of the current instance inside the Fishes group while looping through its members and assign it to the linked (via id variable) TextObject inside the "Worth_Indicator" group?
I tried to access it via "Fishes.VariableString(id)" but the result was "0" so I guess it doesn't automatically try to access the instance's variables.
I hope you understand what I mean. ^^
- Fishes (guppy, goldfish, ...)
- Worth_Indicator (Coin, Worth_Text)