CCSprite in cocos2d v2.0 rc0

I'm a little confused about CCSprite's position: is this it's center or bottom left? CCNode, CCLayer, CCMenu, CCMenuItem are the same?

Answers


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


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/


Need Your Help

What are the limitations of Loose XAML?

.net wpf data-binding xaml seo

I have been experimenting with WPF and rendering strict XAML markup in a web browser, also known as Loose XAML (explained here and here).

Error initializing guard-livereload

windows guard livereload

I'm trying to install guard live reload on windows. So far I've got guard installed and working via bundler. But after installing the livereload gem and trying guard init livereload and bundler e...