Skip to content

Commit

Permalink
Merge pull request #1 from existancepy/main
Browse files Browse the repository at this point in the history
lower case keypress detection
  • Loading branch information
TitanPlayz100 authored Aug 31, 2024
2 parents 71db8f2 + c6c6a6c commit a80241a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions code.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ this.addEventListener('keydown', event => {
if (firstMove && event.key != 'Escape') firstMovement();
if (event.key == controlSettings.resetKey) { playSound('retry'); startGame(); }
if (gameEnd) return;
if (event.key == controlSettings.cwKey) rotate("CW");
if (event.key == controlSettings.ccwKey) rotate("CCW");
if (event.key == controlSettings.rotate180Key) rotate("180");
if (event.key == controlSettings.hdKey) harddrop();
if (event.key == controlSettings.holdKey) switchHold();
if (event.key == controlSettings.rightKey) startDas("RIGHT");
if (event.key == controlSettings.leftKey) startDas("LEFT");
if (event.key == controlSettings.sdKey) startArrSD();
if (event.key.toLowerCase() == controlSettings.cwKey) rotate("CW");
if (event.key.toLowerCase() == controlSettings.ccwKey) rotate("CCW");
if (event.key.toLowerCase() == controlSettings.rotate180Key) rotate("180");
if (event.key.toLowerCase() == controlSettings.hdKey) harddrop();
if (event.key.toLowerCase() == controlSettings.holdKey) switchHold();
if (event.key.toLowerCase() == controlSettings.rightKey) startDas("RIGHT");
if (event.key.toLowerCase() == controlSettings.leftKey) startDas("LEFT");
if (event.key.toLowerCase() == controlSettings.sdKey) startArrSD();
});

this.addEventListener('keyup', event => {
if (event.key == controlSettings.rightKey) endDasArr('RIGHT');
if (event.key == controlSettings.leftKey) endDasArr('LEFT');
if (event.key == controlSettings.sdKey) endDasArr('DOWN');
if (event.key.toLowerCase() == controlSettings.rightKey) endDasArr('RIGHT');
if (event.key.toLowerCase() == controlSettings.leftKey) endDasArr('LEFT');
if (event.key.toLowerCase() == controlSettings.sdKey) endDasArr('DOWN');
});

function firstMovement() {
Expand Down Expand Up @@ -756,7 +756,7 @@ function closeModal(id) {
if (type == 'number' && setting.value == '') setting.value = currentRangeOption.min;
eval(settingGroup)[settingid] =
type == 'check' ? setting.checked :
type == 'keybind' ? setting.textContent :
type == 'keybind' ? setting.textContent.toLowerCase() :
setting.classList[2] == 'exp' ? toExpValue(setting.value) :
setting.value;
if (settingid == 'nextQueue') {
Expand Down

0 comments on commit a80241a

Please sign in to comment.