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?
Asked
Active
Viewed 7,639 times
2 Answers
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

ROOP KISHOR
- 51
- 3
-
Thank for you help. Is there a cocos2d-js version for this? I have google it but I cant find it any more. – DDa Nov 16 '14 at 14:34
-
you can download the latest version v3.1 it supported cocostudiohttp://www.cocos2d-x.org/download – ROOP KISHOR Nov 17 '14 at 06:33
-
no, I have use cocos2d-js now. and I think cocostudio is not support cocos2d-js now. – DDa Nov 17 '14 at 13:01
-
1Cocos2d-JS v3.0 is compatible with Cocos Studio v1.2 - v2.0. – ROOP KISHOR Nov 18 '14 at 13:30
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
-
-
1@DDa you should add "extensions" to the modules list in your project.json – Yana D. Nugraha Nov 26 '14 at 18:41
-
This is now: var cssResource = css.load("res/node.csb"); this.addChild(cssResource.node) – John Magistr Mar 23 '15 at 15:51