cocos2dx

cocos2dx 3.0 AnchorPoint and position relationship

  • see figure

write picture description here

- When you do the rotation animation, the image will rotate around the trace position.
- When you set setPosition(), the value you set is the distance from the screen XY axis to the trace point.

Size winSize = Director::getInstance()->getWinSize();

_background = Sprite::create("res/xxx.png");
//_background -> AnchorPoint(0.5,0.5);//图片中心为描点
_background -> setPosition(Vec2(winSize.width/2, winSize.height/2));//默认为中心描点到原点的xy轴距离

this -> addChild(_background);

cocos2dx 3.01.
 


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325810592&siteId=291194637