Last active
December 23, 2021 11:30
-
-
Save shohan4556/8579eaefa94f331e20f9a05b99764d2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//box3 | |
const box3 = this.add.container(startX / 2 - 100, 350).setDepth(20); | |
square = this.add.sprite(0, 0, "square").setOrigin(0.5).setScale(0.5); | |
number = this.add.text(40, -50, 3, { color: 0xffff }); | |
item = this.add.image(0, 0, this.levelData[index].boxs[0]).setOrigin(0.5); | |
box3.add(square); | |
box3.add(number); | |
box3.add(item); | |
box3.setSize(128, 128); | |
box3.setInteractive(); | |
box3.on( | |
"pointerdown", | |
this.checkWinLoss.bind(this, { | |
clicked: 3, | |
answer: this.levelData[index].answer, | |
}) | |
); | |
//--------------------// | |
checkWinLoss(data, pointer, localX, localY) { | |
console.log("check win loss ", data); | |
} | |
shuffleArray(array) { | |
for (let i = array.length - 1; i > 0; i--) { | |
const j = Math.floor(Math.random() * (i + 1)); | |
[array[i], array[j]] = [array[j], array[i]]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment