About settings for cocos2d-x coordinates and locations

Source: Internet
Author: User

The coordinate in 1.cocos2d-x (0,0) is the lower-left corner of the run box, so the Run box looks like a first quadrant.

2. The anchor point of the node is the position set by our setposition, the default anchor point is at the center of the node, that is, the coordinates set by the SetPosition method, such as SetPosition (VISIBLESIZE.WIDTH/2, VISIBLESIZE.HEIGHT/2) is to put the picture in the center of the Run box.

3. If you want to change the anchor point, you can use the Setanchorpoint method to set, Setanchorpoint coordinates are the node (picture) as a relative coordinate system, such as Sprite->setanchorpoint (0,0), is to set the anchor point in the bottom left corner of the sprite node, this time if Sprite->setposition (0,0), the picture will be placed in the bottom left corner of the Run box.

The 4.sprite->getcontentsize () method is to get the size of the sprite node, which is a Vec2 type of value, with the width and height properties.

About settings for cocos2d-x coordinates and locations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.