From dca1cbef4dfddbcdc2705dd743ff23918adeaa3e Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Sun, 30 Aug 2026 18:40:56 -0600 Subject: [PATCH] Add difficulty-based reference image and ghost slot visibility to Jigsaw - Hide the faint full-picture reference on Hard and Legendary levels - Show the target-slot ghost preview only on Easy while dragging a piece - Store the selected difficulty on the scene for these checks --- src/games/jigsaw/JigsawGame.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/games/jigsaw/JigsawGame.js b/src/games/jigsaw/JigsawGame.js index b2c01c2..6389cf0 100644 --- a/src/games/jigsaw/JigsawGame.js +++ b/src/games/jigsaw/JigsawGame.js @@ -372,6 +372,7 @@ export default class JigsawGame extends Phaser.Scene { this.startTime = 0; this.elapsed = 0; this.seed = (Math.random() * 1e9) | 0; this.jig = makeJigsaw(this.cols, this.rows, this.seed); + this.difficulty = this.selectedDiff; this.diffLabel = `${cfg.label} ยท ${this.total} pieces`; this.imageName = item.name || 'Image'; @@ -402,6 +403,8 @@ export default class JigsawGame extends Phaser.Scene { if (this.textures.exists('jigsaw-ref')) this.textures.remove('jigsaw-ref'); this.textures.addCanvas('jigsaw-ref', rcv); this.refImage = this.add.image(bcx, bcy, 'jigsaw-ref').setDisplaySize(BOARD.size, BOARD.size).setAlpha(0.16).setDepth(3); + // Faint full-picture reference: keep on Easy/Medium, hide on Hard/Legendary. + this.refImage.setVisible(this.difficulty !== 'hard' && this.difficulty !== 'legendary'); // Build piece textures + sprites const texKey = (r, c) => `jg-${this.seed}-${r}-${c}`; @@ -636,7 +639,12 @@ export default class JigsawGame extends Phaser.Scene { piece.img.setDepth(this.zTop); this.dragging = { piece, offX: piece.img.x - w.x, offY: piece.img.y - w.y }; this.suppressNextButtonClick = true; - this.ghost.setTexture(piece.img.texture.key).setPosition(piece.home.x, piece.home.y).setVisible(true); + // Show the target ghost (brighter alpha preview of the home slot) on Easy only. + if (this.ghost && this.difficulty === 'easy') { + this.ghost.setTexture(piece.img.texture.key).setPosition(piece.home.x, piece.home.y).setVisible(true); + } else if (this.ghost) { + this.ghost.setVisible(false); + } playSound(this, SFX.UI_PICK); }