动作(Action)

    1. auto mySprite = Sprite::create("mysprite.png");
    2. mySprite->setPosition(Vec2(200, 256));
    3. // MoveBy - lets move the sprite by 500 on the x axis over 2 seconds
    4. auto moveBy = MoveBy::create(2, Vec2(500, mySprite->getPositionY()));
    5. // MoveTo - lets move the new sprite to 300 x 256 over 2 seconds
    6. // MoveTo is absolute - The sprite gets moved to 300 x 256 regardless of
    7. // where it is located now.
    8. // Delay - create a small delay
    9. auto delay = DelayTime::create(1);
    10. auto seq = Sequence::create(moveBy, delay, moveTo, nullptr);
    11. mySprite->runAction(seq);