您的位置:首页 > 移动开发 > Cocos引擎

cocos2dx使用cocostudio导出的animation

2014-06-18 17:57 399 查看
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")



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: