It's very easy to position a sprite object in relation to another sprite object, if you don't mess with the rotation. As the title states I want to know how to position 2 MC in relation to an already rotated MC, so they are aligned to each other. The big rocket is at an angle of 35 degrees.
First i set the angle of the big rocket to 0 degree, I am adding the 2 small rockets on the stage and position them on each side of the bigger rocket. So far so good... I am rotating everything back to the initial angle (35 degrees), but something is not right, as you can see the results in pic1
What must I change, so that the 2 small rockets stays perfectly aligned (one on the left side, the other on the right side of the bigger rocket) and rotated, as in pic2?
The registration point for all objects is in the upper-left corner.Edit: The 2 small rockets must reside outside the bigger rocket container, because, eventually they will be animated independently from the container.
var _rot = rocketShip.rotation;
rocketShip.rotation = 0;
addChild(_leftRocket);
addChild(_rightRocket);
_leftRocket.x = rocketShip.x - _leftRocket.width;
_leftRocket.y = rocketShip.y + 20;
_rightRocket.y = rocketShip.x + _rightRocket.width;
_rightRocket.y = rocketShip.y + 20;
rocketShip.rotation = _rot;
_leftRocket.rotation = _rightRocket.rotation = rocketShip.rotation;