cc.Class({ extends: cc.Component, properties: { sprite_frames: { default: null, type: cc.SpriteAtlas } }, onLoad() { this.addComponent(cc.Sprite).spriteFrame = this.sprite_frames.getSpriteFrame("card_black"); }, start() { }, // update (dt) {}, });
this.node.addComponent(cc.Sprite).spriteFrame = this.sprite_frames[Math.round(Math.random() * this.sprite_frames.length)]; this.addComponent(cc.Sprite).spriteFrame = this.sprite_frames.getSpriteFrame("card_black");
站长微信:xiaomao0055
站长QQ:14496453