Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Change position relation between Parent and Children

$
0
0

Lets say we have a CCLayer object (layer) and a CCSprite object (sprite)

layer.AddChild(sprite)

I know that the position of the sprite will always be relative to the layer's position.

layer.Position = new CCPoint(100, 100);
sprite.Position = new CCPoint(100, 100); // on the screen this would be (200, 200)

How can I change that relation? Like setting an offset for child nodes for example.
To clarify what i mean this is what i would like to have:

layer.ChildrenPositionOffset = new CCPoint(100, 100);  // ChildrenPositionOffset does not exist!! This is what i would like to have
layer.Position = new CCPoint(0, 0);
sprite.Position = new CCPoint(100, 100); // This should be at (200, 200) on screen now

So basically i want to keep the layer's position but change the origin of its children position.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>