Comments on: Cocos2d-x Cross-Platform Game Development for iOS, Android, and Windows Phone 8 http://heyalda.com/cocos2d-x-cross-platform-game-development-for-ios-android-and-windows-phone-8/ Heyalda specializes in mobile app, web service and responsive web app development. Thu, 25 Feb 2016 19:46:58 +0000 hourly 1 https://wordpress.org/?v=5.3.2 By: Jim Range http://heyalda.com/cocos2d-x-cross-platform-game-development-for-ios-android-and-windows-phone-8/comment-page-1/#comment-12387 Thu, 25 Feb 2016 19:46:58 +0000 http://heyalda.com/?p=1427#comment-12387 The getContentSize returns the size of the node. For a sprite, that will be the size of the image/frame that was loaded, regardless of the scale of the sprite. For sprites, you probably don’t want to change the content size. Instead, you would change the scale of the sprite. The content size would always be the same for the sprite, regardless of the scale you might set. I imagine that changing content size would just result in unexpected behavior with the anchor point and positioning of the sprite.

Sometimes with a node or layer you might want to set the content size if you want to change the anchor point from the bottom left corner. But other than that, I cannot think of a reason why you would want or need to change the content size of a node or a node subclass (sprite is a subclass of a node).

]]>
By: Vineet Avasthi http://heyalda.com/cocos2d-x-cross-platform-game-development-for-ios-android-and-windows-phone-8/comment-page-1/#comment-12386 Thu, 25 Feb 2016 17:28:50 +0000 http://heyalda.com/?p=1427#comment-12386 Hi Jim,

I’m a beginner and still in learning phase o Cocos2d-x for Android. Your articles are great and have so much relevance. I have a question, I would like to understand about – what does this function do – getContentSize()?

And what happnes when we divide width or height by 2
For eg – sprite->getContentSize().height/2

When you apply this to a sprite, What happens then ? What changes it brings ?

Thanks,
Vineet Avasthi

]]>