Reputation: 4732
I'm a little confused about CCSprite's position
: is this it's center or bottom left? CCNode, CCLayer, CCMenu, CCMenuItem are the same?
Upvotes: 0
Views: 317
Reputation: 64478
It's the center by default, except for CCNode, CCLayer and CCScene where it is the lower left corner.
Since the CCNode has 0 width and 0 height the lower left corner equals its center unless you set the contentSize property manually.
The anchorpoint can modify where the texture is drawn over a node's position. Typically you don't want to change it though. See here: https://stackoverflow.com/a/7810180/201863
Upvotes: 1
Reputation: 4054
position
and anchorPoint
are correlated fields; by default, position refers to where the center-point of the sprite (node) is to be placed. This is because an anchorPoint is = ccp(0.5, 0.5)
by default for any given CCNode
inheritor. Please note that anchorPoint is measured in units of percentage of the dimensions of the node it is describing.
Here is an excellent article that helped me get my head around it back when I was learning: http://www.qcmat.com/understanding-anchorpoint-in-cocos2d/
Upvotes: 1