how to use .csb file after published project from cocostudio

7.7k Views Asked by At

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?

2

There are 2 best solutions below

4
On
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

3
On

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);