引擎01——plist图集使用方法

2021-06-24  本文已影响0人  GameObjectLgy
cc.Class({
extends: cc.Component,

    properties: {
        //使用的图集
        stars:{
            default: null,
            type: cc.SpriteAtlas
        },
    },
    
    onLoad: function () {
        var node = new cc.Node('Ten');
        node.width = 240;
        node.height = 240;
        var sp = node.addComponent(cc.Sprite);
        //this.stars._spriteFrames 为图集对象
        //对象名称:xq009 即图片名称
        sp.spriteFrame = this.stars._spriteFrames.xq009;
        //....省略部分代码
    }
});

上一篇 下一篇

猜你喜欢

热点阅读