I have multiple instance of Sprite and Text
i want to pin each text over sprites.
I am trying with "for each" but something wrong i doing.
please help.
You should set the position of text before pinning it.
text is already positioned over sprite as you can see in image above
Develop games in your browser. Powerful, performant & highly capable.
Do you use Container?
I think right now the text won't know which one should pin yet, and it will choose random sprite.
No I am not using Container because i am using text for other purpose too where i use another sprites
give each text and each sprite an instance variable like which = 1 ( from 1 to 10 )
Then do for each sprite, add subevent if text.which = sprite.which text.setposition Sprite.X and Sprite.Y ( + whatever offset you need to cernter it, if any )
i want to pin them together but not by using positions.
Isn't the pin behavior basically the same thing, only in a form of a behavior?
Well, same logic should work even if you use pin behavior
Yes i know, but i was just willing to learn how to do with pin behavior.
I have got it working.