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: http://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

tops command giving error when executed through NSTask

cocoa nstask

I am trying to use below tops command through NSTask:

CodeIgniter: Not able to hit controller specific method

php codeigniter

I am new to Codeigniter. While trying to access controller specific method, I am getting 'Object Not found' exception.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.