cocos2dx 动作篇 重复动作 RepeatForever的用法

Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
Sprite * sp = Sprite::create("HelloWorld.png");
sp->setPosition(Point(visibleSize.width/2,visibleSize.height/2));
this->addChild(sp);
//创建一个弹跳的动作
JumpBy * jumpby = JumpBy::create(3.0f, Point(50,1),100,1);
//创建一个永久性的重复动作
RepeatForever * repeatforever = RepeatForever::create(jumpby);


//有限次的动作重复
Repeat * repeat = Repeat:: create(jumpby,3);
sp->runAction(repeat);

你可能感兴趣的:(cocos2dx)