cocos2dx三角函数与小球

//第二课

_angle = 0;
_width = 0;
//点
auto dot = DrawNode::create();
dot->drawDot(Vec2(0,0),10,Color4F(1.0,1.0,1.0,1.0));
addChild(dot);
dot->setPosition(visibleSize / 2);


schedule([dot,this,visibleSize](float f){


dot->setPositionY(visibleSize.height/2+sin(_angle)*100.0);


dot->setPositionX(_width);


_width += 1;
_angle+=0.1;
if (_angle > 360) _angle = 0;

if (_width > visibleSize.width) _width = 0;


cocos2dx三角函数与小球_第1张图片

你可能感兴趣的:(cocos2dx)