How to move a Entity without moving its children in AndEngine?

| | August 11, 2015

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?

One Response to “How to move a Entity without moving its children in AndEngine?”

  1. Plastic Sturgeon on November 30, -0001 @ 12:00 AM

    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.

Leave a Reply