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
This commit is contained in:
parent
22e6b68cef
commit
dca1cbef4d
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue