diff --git a/assets/scripts/puzzle.js b/assets/scripts/puzzle.js index 389c66b..f7ba1aa 100644 --- a/assets/scripts/puzzle.js +++ b/assets/scripts/puzzle.js @@ -9,13 +9,14 @@ cc.Class({ imageNode: { default: null, type: cc.Node - } + }, + imgs: [] }, // LIFE-CYCLE CALLBACKS: onLoad () { - for (let i = 0; i < 5; i++) { + for (let i = 0; i < 9; i++) { var img = cc.instantiate(this.imagePrefab); img.getComponent('puzzleImage').imgIndex = i; img.getComponent('puzzleImage').type = 0; @@ -33,6 +34,8 @@ cc.Class({ x = 202; } img.setPosition(cc.v2(x, y)); + img.active = false; + this.imgs.push(img); } }, @@ -41,4 +44,9 @@ cc.Class({ }, // update (dt) {}, + updateValues(valArr) { + for(let i = 0; i < this.imgs.length; i++) { + this.imgs[i].active = !!valArr[i] + } + } }); diff --git a/assets/scripts/scrollContent.js b/assets/scripts/scrollContent.js index 6cd6075..c2aacb6 100644 --- a/assets/scripts/scrollContent.js +++ b/assets/scripts/scrollContent.js @@ -83,6 +83,7 @@ cc.Class({ let self = this; this.scheduleOnce(function () { processBar.getComponent('progressBar').updateShow(35000); + puzzle.getComponent('puzzle').updateValues([0,1,0,1,0,1,1,0,1]) }, 5); },