mirror of
https://github.com/cmclark00/tetris-3d.git
synced 2025-05-17 23:25:21 +01:00
Fix double-tap hard drop issue when 3D effects are disabled
This commit is contained in:
parent
4cb5250465
commit
742cbb1297
1 changed files with 20 additions and 8 deletions
28
script.js
28
script.js
|
@ -670,6 +670,13 @@ class Piece {
|
||||||
|
|
||||||
// Hard drop
|
// Hard drop
|
||||||
hardDrop() {
|
hardDrop() {
|
||||||
|
// Cancel any ongoing rotations or animations
|
||||||
|
this.rotationTransition = false;
|
||||||
|
this.showCompletionEffect = false;
|
||||||
|
this.rotationAngleX = 0;
|
||||||
|
this.rotationAngleY = 0;
|
||||||
|
this.rotationAngleZ = 0;
|
||||||
|
|
||||||
// Clear previous position
|
// Clear previous position
|
||||||
this.undraw();
|
this.undraw();
|
||||||
clearPreviousPiecePosition();
|
clearPreviousPiecePosition();
|
||||||
|
@ -2402,21 +2409,26 @@ function handleTouchEnd(event) {
|
||||||
// This is a double-tap, do hard drop
|
// This is a double-tap, do hard drop
|
||||||
p.hardDrop();
|
p.hardDrop();
|
||||||
|
|
||||||
// Reset tap tracking
|
// Reset tap tracking to prevent any further actions
|
||||||
lastTapTime = 0;
|
lastTapTime = 0;
|
||||||
|
lastTapX = 0;
|
||||||
|
lastTapY = 0;
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
console.log("Double tap detected - hard drop");
|
console.log("Double tap detected - hard drop");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Single tap - rotates piece
|
// Only rotate if we're not in the middle of another action
|
||||||
p.rotate('right');
|
if (!p.rotationTransition && !p.showCompletionEffect) {
|
||||||
|
// Single tap - rotates piece
|
||||||
// Update tracking for potential double tap
|
p.rotate('right');
|
||||||
lastTapTime = touchEndTime;
|
|
||||||
lastTapX = touchX;
|
// Update tracking for potential double tap
|
||||||
lastTapY = touchY;
|
lastTapTime = touchEndTime;
|
||||||
|
lastTapX = touchX;
|
||||||
|
lastTapY = touchY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset touch identifier
|
// Reset touch identifier
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue