You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then in your game layer, you make an animation node like this:
#include<AnimationNode.h>//an update or init method in a Node or Layer //path to your scml in your Resources folderauto scml = FileUtils::getInstance()->fullPathForFilename("my_animation.scml");
//AnimationNode is a container which can play multiple animations sourced from a single model.auto spriter = Spriter2dX::AnimationNode::create(scml);
//If the images used in your animation are in a spritesheet you've //loaded into the Cocos2d frame cache, instantiate the AnimationNode like//this to load images from there instead:auto spriter = Spriter2dX::AnimationNode::create(scml, Spriter2dX::AnimationNode::cacheLoader());
//createEntity gives you a SpriterEngine::EntityInstance that you can manipulate.//(refer to SpriterPlusPlus API)//You can keep an EntityInstance* as long as your AnimationNode instance is//retained; it will delete them when it is deleted.auto entity = spriter->createEntity("entity_000");
entity->setCurrentAnimation(1);
/* Adding this node to a visible layer will automatically schedule its update loop. no further maintenance is required, use the EntityInstance to stop/start/switch your animations and call createEntity again to setup a new animation in the same node. */this->addChild(spriter,5);
spriter->setPosition(Vec2(origin.x,visibleSize.height));
About
Spriter for Cocos2d-X based on SpriterPlusPlus Reference Implementation