3

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?

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
DDa
  • 41
  • 1
  • 2

2 Answers2

5
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

4

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);    
Gianni
  • 41
  • 1