1
\$\begingroup\$

I have a Entity in AndEngine and when I move it, all child move together with it. Which is great. But, sometimes, I need to move it without moving its children. Is it even possible? And, if it is, how can I do so?

\$\endgroup\$
  • 2
    \$\begingroup\$ Move the parent would move the children anyway, as child position are based on parent's. You could add the inverse transformation in the children if you want them back at original place. \$\endgroup\$ – felipe Nov 25 '13 at 19:49
1
\$\begingroup\$

its not possible as you have it set up now. Children inherit the transform of their parents. You will have to do some extra work. Here are two suggestions:

Make it appear that they move separately, but applying an opposite transform to each child. For example if the parent translates 10 x, move each child -10 x. It will appear not to move.

Another approach, would be to construct your Entity groups differently, so that the current parent entity and its children were all siblings within a common EntityContainer parent. That way when you want to move them all, you move the parent, and when you want to move the one part, you move the one part.

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ Sorry. I just saw it now. Thanks for the reply. I've used the first approach. \$\endgroup\$ – Weslley Alcobaça Sep 23 '14 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.