local ui
local function createLayerUI()
if not ui then
ui=cc.Layer:create();
createLayerUI=nil;
end
return ui;
end
local sc
local function createLayerScene()
if not sc then
sc=cc.Layer:create();
createLayerScene=nil;
end
return sc;
end
local entity
local function createLayerEntity()
if not entity then
entity=cc.Layer:create();
createLayerEntity=nil;
end
return entity;
end
cc.FileUtils:getInstance():addSearchPath("res")
local sceneGame=cc.Scene:create()
sceneGame:addChild(createLayerUI())
cc.Director:getInstance():runWithScene(sceneGame)
--ui:addChild(ccs.GUIReader:shareReader():widgetFromJsonFile("res/SampleChangeEquip_1.json"))
print("format", tostring({}))
sceneGame:addChild(createLayerScene())
local node =ccs.SceneReader:getInstance():createNodeWithSceneFile("res/RPGGame.json")
sc:addChild(node)
node:setPosition(-200,-100)
sceneGame:addChild(createLayerEntity())
ccs.ArmatureDataManager:getInstance():addArmatureFileInfo("res/DemoPlayer.ExportJson");
local armature = ccs.Armature:create("DemoPlayer");
armature:setPosition(200, 200);
armature:setScaleX(0.2);
armature:setScaleY(0.2);
entity:addChild(armature);
armature:getAnimation():play("walk")
cocos2dx使用cocostudio导出的animation,布布扣,bubuko.com
cocos2dx使用cocostudio导出的animation
原文:http://www.cnblogs.com/marcher/p/cocos2dxanimation.html