auto sprite = Sprite::create("ball.png"); auto moveTo = MoveTo::create(2, Vec2(200, 100)); sprite->runAction(moveTo);
auto node = Node::create(); auto scaleTo = ScaleTo::create(1, 2); node->runAction(scaleTo);
auto sprite = Sprite::create("fish.png"); auto rotateBy = RotateBy::create(1, 360); auto rotateRepeat = RepeatForever::create(rotateBy); sprite->runAction(rotateRepeat);In this third example, we create a sprite and an action that rotates it continuously by 360 degrees over a duration of 1 second. We then use a RepeatForever action to repeat the rotation indefinitely. Package/library: Cocos2d-x Overall, the runAction method of CCNode is a powerful tool for creating interactive and animated game objects. These examples show just a few of the many ways in which it can be used to create dynamic and engaging game experiences.