|
|
|
@ -1,6 +1,7 @@ |
|
|
|
import gems from "./gems.png"; |
|
|
|
import Match3 from "./match3"; |
|
|
|
import bg from "./bg.jpg"; |
|
|
|
import tip from "./tip.png"; |
|
|
|
import "../../font.css"; |
|
|
|
const gameOptions = { |
|
|
|
gemSize: 260, |
|
|
|
@ -18,6 +19,7 @@ export default class playGame extends Phaser.Scene { |
|
|
|
super("scene"); |
|
|
|
} |
|
|
|
preload() { |
|
|
|
this.load.image("tip", tip); |
|
|
|
this.load.image("bg", bg); |
|
|
|
this.load.spritesheet("gems", gems, { |
|
|
|
frameWidth: gameOptions.frameSize, |
|
|
|
@ -58,6 +60,19 @@ export default class playGame extends Phaser.Scene { |
|
|
|
this.dragging = false; |
|
|
|
this.drawField(); |
|
|
|
this.input.on("pointerdown", this.gemSelect, this); |
|
|
|
this.instructionWrapper = this.add.rectangle( |
|
|
|
this.game.config.width / 2, |
|
|
|
this.game.config.height / 2, |
|
|
|
this.game.config.width, |
|
|
|
this.game.config.height, |
|
|
|
0x000000, |
|
|
|
0.6 |
|
|
|
); |
|
|
|
this.instructions = this.add.image( |
|
|
|
this.game.config.width / 2, |
|
|
|
this.game.config.height / 2, |
|
|
|
"tip" |
|
|
|
); |
|
|
|
} |
|
|
|
drawField() { |
|
|
|
this.poolArray = []; |
|
|
|
@ -82,6 +97,11 @@ export default class playGame extends Phaser.Scene { |
|
|
|
} |
|
|
|
} |
|
|
|
gemSelect(pointer) { |
|
|
|
if (this.instructionWrapper.active) { |
|
|
|
this.instructionWrapper.destroy(); |
|
|
|
this.instructions.destroy(); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.canPick) { |
|
|
|
this.dragging = true; |
|
|
|
let row = Math.floor( |
|
|
|
|