mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
Refactor locksmith-forge and lockpicking-game-phaser: Update sensitivity and lift speed calculations in locksmith-forge.html for improved gameplay dynamics. Enhance user feedback in lockpicking-game-phaser.js by adding vibration feedback on key actions, including tension application and pin setting, to enrich the player experience.
This commit is contained in:
@@ -280,6 +280,7 @@ export class LockpickingMinigamePhaser extends MinigameScene {
|
||||
// Play tension sound
|
||||
if (this.sounds.tension) {
|
||||
this.sounds.tension.play();
|
||||
navigator.vibrate([200]);
|
||||
}
|
||||
|
||||
if (this.lockState.tensionApplied) {
|
||||
@@ -982,6 +983,7 @@ export class LockpickingMinigamePhaser extends MinigameScene {
|
||||
// Play click sound
|
||||
if (this.sounds.click) {
|
||||
this.sounds.click.play();
|
||||
navigator.vibrate(200);
|
||||
}
|
||||
|
||||
// Hide labels on first pin click
|
||||
@@ -1135,6 +1137,8 @@ export class LockpickingMinigamePhaser extends MinigameScene {
|
||||
// Play overpicking sound
|
||||
if (this.sounds.overtension) {
|
||||
this.sounds.overtension.play();
|
||||
navigator.vibrate(500);
|
||||
|
||||
}
|
||||
|
||||
// Mark as overpicked and stuck
|
||||
@@ -1234,6 +1238,7 @@ export class LockpickingMinigamePhaser extends MinigameScene {
|
||||
// Play overpicking sound
|
||||
if (this.sounds.overtension) {
|
||||
this.sounds.overtension.play();
|
||||
navigator.vibrate(500);
|
||||
}
|
||||
|
||||
if (pin.isSet) {
|
||||
@@ -1327,7 +1332,12 @@ export class LockpickingMinigamePhaser extends MinigameScene {
|
||||
const boundaryPosition = -50 + pin.driverPinLength - pin.currentHeight;
|
||||
const distanceToShearLine = Math.abs(boundaryPosition - shearLineY);
|
||||
|
||||
if (distanceToShearLine < 5 && this.highlightPinAlignment) {
|
||||
// Calculate threshold based on sensitivity (same as pin setting logic)
|
||||
const baseThreshold = 8;
|
||||
const sensitivityFactor = (9 - this.thresholdSensitivity) / 8; // Updated for 1-8 range
|
||||
const threshold = baseThreshold * sensitivityFactor;
|
||||
|
||||
if (distanceToShearLine < threshold && this.highlightPinAlignment) {
|
||||
// Show green highlight when boundary is at shear line (only if alignment highlighting is enabled)
|
||||
if (!pin.shearHighlight) {
|
||||
pin.shearHighlight = this.scene.add.graphics();
|
||||
@@ -1504,10 +1514,10 @@ export class LockpickingMinigamePhaser extends MinigameScene {
|
||||
const distanceToShearLine = Math.abs(boundaryPosition - shearLineY);
|
||||
const shouldBind = this.shouldPinBind(pin);
|
||||
|
||||
// Calculate threshold based on sensitivity (1-10)
|
||||
// Calculate threshold based on sensitivity (1-8)
|
||||
// Higher sensitivity = smaller threshold (easier to set pins)
|
||||
const baseThreshold = 8;
|
||||
const sensitivityFactor = (11 - this.thresholdSensitivity) / 10; // Invert so higher sensitivity = smaller threshold
|
||||
const sensitivityFactor = (9 - this.thresholdSensitivity) / 8; // Invert so higher sensitivity = smaller threshold
|
||||
const threshold = baseThreshold * sensitivityFactor;
|
||||
|
||||
// Debug logging for threshold calculation
|
||||
@@ -1582,6 +1592,7 @@ export class LockpickingMinigamePhaser extends MinigameScene {
|
||||
// Play set sound
|
||||
if (this.sounds.set) {
|
||||
this.sounds.set.play();
|
||||
navigator.vibrate([200,100,200]);
|
||||
}
|
||||
|
||||
this.updateFeedback(`Pin ${pin.index + 1} set! (${this.lockState.pinsSet}/${this.pinCount})`);
|
||||
@@ -1810,6 +1821,7 @@ export class LockpickingMinigamePhaser extends MinigameScene {
|
||||
// Play success sound
|
||||
if (this.sounds.success) {
|
||||
this.sounds.success.play();
|
||||
navigator.vibrate([200,100,200,100,200]);
|
||||
}
|
||||
|
||||
this.updateFeedback("Lock picked successfully!");
|
||||
|
||||
@@ -358,8 +358,8 @@
|
||||
// Base progression
|
||||
let pinCount = Math.min(3 + Math.floor((level - 1) / 5), 8); // 3-8 pins
|
||||
let difficulty = this.getDifficulty(level);
|
||||
let sensitivity = Math.max(1, Math.min(10, 5 + Math.floor((level - 1) / 3))); // 1-10
|
||||
let liftSpeed = Math.max(0.5, Math.min(3.0, 0.8 + (level - 1) * 0.04)); // 0.5-3.0 (starts slower, progresses slower)
|
||||
let sensitivity = Math.max(1, Math.min(8, 1 + Math.floor((level - 1) / 5.57))); // 1-8, reaches 8 at level 40
|
||||
let liftSpeed = Math.max(0.5, Math.min(3.0, 0.6 + (level - 1) * 0.03)); // 0.5-3.0 (starts much slower, progresses very gradually)
|
||||
|
||||
// Add some randomness and complexity
|
||||
if (level > 10) {
|
||||
@@ -386,8 +386,8 @@
|
||||
difficulty,
|
||||
sensitivity,
|
||||
liftSpeed: Math.round(liftSpeed * 10) / 10,
|
||||
highlightBindingOrder: level <= 15 ? 'enabled' : (Math.random() > 0.5 ? 'enabled' : 'disabled'),
|
||||
pinAlignmentHighlighting: level <= 10 ? 'enabled' : (Math.random() > 0.6 ? 'enabled' : 'disabled')
|
||||
highlightBindingOrder: (level % 10 === 0) ? 'disabled' : (level <= 15 ? 'enabled' : (Math.random() > 0.5 ? 'enabled' : 'disabled')),
|
||||
pinAlignmentHighlighting: (level % 10 === 0) ? 'disabled' : (level <= 10 ? 'enabled' : (Math.random() > 0.6 ? 'enabled' : 'disabled'))
|
||||
};
|
||||
}
|
||||
|
||||
@@ -464,10 +464,10 @@
|
||||
const params = {
|
||||
pinCount: config.pinCount,
|
||||
difficulty: config.difficulty,
|
||||
thresholdSensitivity: parseInt(document.getElementById('thresholdSensitivity').value),
|
||||
highlightingBindingOrder: document.getElementById('highlightBindingOrder').value,
|
||||
pinAlignmentHighlighting: document.getElementById('pinAlignmentHighlighting').value,
|
||||
liftSpeed: parseFloat(document.getElementById('liftSpeedRange').value),
|
||||
thresholdSensitivity: config.sensitivity,
|
||||
highlightBindingOrder: config.highlightBindingOrder === 'enabled',
|
||||
pinAlignmentHighlighting: config.pinAlignmentHighlighting === 'enabled',
|
||||
liftSpeed: config.liftSpeed,
|
||||
lockable: { id: 'progressive-challenge' },
|
||||
closeButtonText: 'Reset',
|
||||
closeButtonAction: 'reset'
|
||||
|
||||
Reference in New Issue
Block a user