Cocos2D coordinate system settings for iPhone applications

Source: Internet
Author: User

IPhoneApplicationCocos2D coordinatesSystem settings are the content to be introduced in this article. The coordinates must be accurately calculated as friends of game developers. Let's take a look at the detailed introduction in this article.

Cocos2dIt is based on OpenGL ES, and all its coordinate systems are:

AnchorPoint

To precisely place a rectangular image at a certain position on the screen, you need to set the position reference point of the rectangle. People are usually used to think that the reference point is the point in the upper left corner of the rectangle ). This attribute of CocosNode is a reference point. X and Y axes are taken in the OpenGL ES coordinate system, and the values are proportional to their own width and height.

Position

The actual OpenGL ES coordinates of the CocosNode object.

The following describes how to use the return attribute to set the location of the CocosNode object ,:

The Position of the red rectangle is 5, 5), and the anchorPoint is 0.3, 0.5 ). If you want to select the purple circle A as anchorPoint, set 0, 0), if you want to set the pink circle B as anchorPoint, set 1, 1 ). Obviously, when 0.5, 0.5) is set, anchorPoint is the geometric center C of the rectangle object, and returns the default anchorPoint value of the Sprite and Texture class objects.

Summary:IPhoneApplicationCocos2D coordinatesThe system content has been introduced. I hope this article will help you!

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.