Преглед на файлове

clearing matches on board init

Justin Gilman преди 1 година
родител
ревизия
78ed68daf9
променени са 2 файла, в които са добавени 9 реда и са изтрити 4 реда
  1. 7 2
      js/libraries/components/matchthree/Board.js
  2. 2 2
      js/viewer/states/MatchThreeState2.js

+ 7 - 2
js/libraries/components/matchthree/Board.js

@@ -12,7 +12,7 @@ class Board {
         this.actionQueue = new ActionQueue()
         this.selectedTiles = []
     }
-    init(scaledCanvas) {
+    init(canvasBounds) {
         this.boardSize = { x: 7, y: 7 }
         for (let y = 0; y < this.boardSize.y; y++) {
             for (let x = 0; x < this.boardSize.x; x++) {
@@ -20,7 +20,12 @@ class Board {
             }
         }
 
-        this.onResize(scaledCanvas.bounds)
+        this.onResize(canvasBounds)
+
+        // setTimeout(() => {
+        //     console.log("checking for matches on load")
+            this.checkForMatches()
+        // }, 2000)
     }
 
     spawnTile(x, y) {

+ 2 - 2
js/viewer/states/MatchThreeState2.js

@@ -27,9 +27,8 @@ export default class MatchThreeState {
     init(scaledCanvas) {
         this.canvasBounds = scaledCanvas.bounds
 
-        this.boardSize = { x: 7, y: 7 }
         this.buttonCount = 6
-        this.board.init(scaledCanvas)
+        
     }
 
     enter() {
@@ -53,6 +52,7 @@ export default class MatchThreeState {
         this.camera.position.x = 0
         this.camera.position.y = 0
 
+        this.board.init(this.canvasBounds)
         this.alpha = 1
         AsyncTween.create(this, { alpha: 0 }, 500, Easing.Quadratic.EaseOut)
     }