Hey guys! Happy New Year!
I'd like to learn more about the process of adding sprites to a group. Hopefully you can help.
Suppose i have a game piece located on the stage at x:300, y:300. I scripted my game so that if you tap it, I create a group sprite, position it at x:300, y:300, add the piece to it, and set the piece's coordinates to x:0, y:0. As a result, there would be no visible change (such as movement) onscreen, but I've now added that piece to a group.
Suppose I have a second piece on the stage at x:350, y:250, which, when tapped, will be added to the group. Since I created and positioned the group sprite already, I would have expected that I would be able to add the second piece to the group, then position that piece to be x:50, y:-50 (which in theory preserves the positional relationships between the two pieces).
It's altogether possible I have a bug in my code, but that does not appear to work - one of my pieces moves up to x:0, y:0 on the stage (so it's at the upper left corner of the display) and the other one is either right on top of it or off the screen.
So: Is my understanding of how adding pieces to groups without visually altering them correct? If not, how should I be thinking of this?
One tool that may have helped me understand what's going on is the ability to set a background color or a border on the group sprite, and see how added pieces change the group sprite's dimensions. So if you would agree, I'd love to know how I could achieve that effect.