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!