Reputation: 41
I have created a UI for my game. after published project from cocostudio I have got .csb file. how to use it in my game?
Upvotes: 3
Views: 7865
Reputation: 41
Example with js:
var node = ccs.csLoader.createNode("res/node.csb");
var node_action = ccs.actionTimelineCache.createAction("res/node.csb");
node.runAction(node_action);
node.attr({
scale: 0.6,
x: 130,
y: 10,
})
node_action.gotoFrameAndPlay(0, 40, true);
this.addChild(node);
Upvotes: 4
Reputation: 51
Add the header file
#include"cocostudio.h"
Node* node = CSLoader::createNode("background.csb");
this->addChild(node);
//get animation data
cocostudio::timeline::ActionTimeline* action = CSLoader::createTimeline("background.csb");
node->runAction(action);
action->gotoFrameAndPlay(0, true);
it will be helpful for you
Upvotes: 5