Last active
April 18, 2016 16:38
-
-
Save Sumolari/f0b80d1dfb83029e615397e3f046b291 to your computer and use it in GitHub Desktop.
Custom FiniteTimeActions demo with MawKit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MawKit/FiniteTimeActions.hpp" | |
void runPickupCoinAnimation( cocos2d::Node *coin, cocos2d::Node *chest ) { | |
// Move coin to chest. | |
auto moveCoinToChest = MK::Actions::MoveToNode::create( 0.25, chest ); | |
// Bounces chest. | |
std::function<void( void )> bounceChest = [=]() { chest->bounce(); }; | |
// Move coin to chest, then bounce chest, then remove coin form parent. | |
coin->runAction( cocos2d::Sequence::create( | |
moveCoinToChest, | |
cocos2d::CallFunc::create( bounceChest ), | |
MK::Actions::RemoveFromParent::create( 0.1 ), | |
nullptr | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment