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\$
1
  • 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
    Commented Nov 25, 2013 at 19:49

1 Answer 1

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Sorry. I just saw it now. Thanks for the reply. I've used the first approach. \$\endgroup\$ Commented Sep 23, 2014 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .