# Why the AnchorPoint doesn't affect the CCLayer Positioning?

I think there is a difference between the CCLayer and CCNode behavior when I change their AnchorPoint.

I will describe what I mean and please somebody explain it.

Scenario: I start with CCNode

CCNode *node = ...;
node.setContentSize(ccp(W,H));
// 1.
node.setAnchorPoint(ccp(0,0));
node.setPosition(ccp(X,Y); // This line will move the node in a way that its (0,0)-point will be placed at (X,Y).
// 2.
node.setAnchorPoint(ccp(1,1));
node.setPosition(ccp(X,Y); // This line will move the node in a way that its (0,0)-point will be placeed at (X-W,Y-H).
//In other word, this line will move the (W,H)-point of the node to (X,Y)


In addition to the Positioning, all actions (like Rotating, Scaling) are based on this anchor point.

This policy is fair enough and you won't get confused when moving a scaled node (setScale(X)) to some position because the node's position ( and not node's contents!) will not change in the screen after any actions.

( PS: We knew that rotating/scaling a node will rotate/scale internal node contents)

Let's continue with CCLayer:

CCLayer *layer= ...;
layer.setContentSize(ccp(W,H));
// 1.
layer.setAnchorPoint(ccp(0,0));
layer.setPosition(ccp(X,Y); // This line will move the layer in a way that its (0,0)-point will be placed at (X,Y)
// 2.
layer.setAnchorPoint(ccp(1,1));
layer.setPosition(ccp(X,Y); // Unfortunately, This line will move the layer in a way that its (0,0)-point will be placeed at (X,Y).


Although CCLayer also use the anchor point for scaling, rotating and ... purposes, It does NOT use its anchor point for positioning!!!

Question >>>> WHY? and How can I have the same CCNode-like setPosition() behaviour for CCLayer?

PS: I've also tried ->ignoreAnchorPointForPosition(true) but it didn't help.

(@cocos2d-x version is 2.2.3)

You say you have tried setting ignoreAnchorPointForPosition(true), but have you tried setting it to false?
CCLayer init method calls ignoreAnchorPointForPosition(true)`, which basically tells cocos to ignore the anchor point for positioning. You can set it to false and it should respect the anchor point for position.