Background.js 289 B

1234567891011121314
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. bgFrames: [cc.SpriteFrame],
  5. bgWrap: cc.Node
  6. },
  7. onLoad () {
  8. let ran = Math.floor(cc.random0To1() * 3)
  9. this.bgWrap.getComponent(cc.Sprite).spriteFrame = this.bgFrames[ran];
  10. },
  11. });