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

cocos2d-htm5使用cocostudio 动画

2014-02-09 20:34 260 查看
var s_Cowboy_json = "res/Cowboy.ExportJson";
var s_Cowboy_plist = "res/Cowboy0.plist";
var s_Cowboy_png = "res/Cowboy0.png";
var s_Dragon_xml = "res/Dragon.xml";
var s_Dragon_png= "res/Dragon.png";
var s_Dragon_plist = "res/Dragon.plist";

var g_resources = [
    //image

    {src:s_Cowboy_json},
    {src:s_Cowboy_plist},
    {src:s_Cowboy_png},

    {src:s_Dragon_plist},
    {src:s_Dragon_xml},
    {src:s_Dragon_png}
    //plist

    //fnt

    //tmx

    //bgm

    //effect
];
var size = cc.Director.getInstance().getWinSize();
        /////////////////////////////
        // 2. add a menu item with "X" image, which is clicked to quit the program
        //    you may modify it.
        // ask director the window size
        // remove sigle resource
        ccs.ArmatureDataManager.getInstance().addArmatureFileInfo(s_Dragon_png, s_Dragon_plist, s_Dragon_xml);
        var armature = ccs.Armature.create("Dragon");
        armature.getAnimation().playWithIndex(0);
        armature.getAnimation().setSpeedScale(0.4);
        armature.setScale(0.6);
        armature.setAnchorPoint(0.5, 0.5);
        armature.setPosition(size.width / 2, size.height / 2);
        this.addChild(armature);

        ccs.ArmatureDataManager.getInstance().addArmatureFileInfo(s_Cowboy_json);
        var armature2 = ccs.Armature.create("Cowboy");
        armature2.getAnimation().play("Fire");
        armature2.setScale(0.2);
        armature2.setAnchorPoint(0.5, 0.5);
        armature2.setPosition(size.width / 2, size.height / 2);
        this.addChild(armature2);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: