diff --git a/css/styles.css b/css/styles.css index 1b0868e..a0dbbe3 100644 --- a/css/styles.css +++ b/css/styles.css @@ -6,7 +6,7 @@ nav ul{height:200px; width:80%;} nav ul{overflow:hidden; overflow-y:scroll;} body{ - background: #3f3f3f; + background: #000000; margin:0; padding:0; position: relative; diff --git a/dist/Failed.ogg b/dist/Failed.ogg new file mode 100644 index 0000000..84f1d5d Binary files /dev/null and b/dist/Failed.ogg differ diff --git a/dist/tetrion.js b/dist/tetrion.js index ada2604..4b57706 100644 --- a/dist/tetrion.js +++ b/dist/tetrion.js @@ -496,8 +496,8 @@ var UserInputs = { // Direction Pad gamepadDPadDown(finds) { - var DAS = 30.0; - var ARR = 20.0; + var DAS = 15.0; + var ARR = 8.0; var isContained = this.gpButtons.includes(finds); var isPrevContained = this.prevGpButtons.includes(finds); @@ -576,8 +576,8 @@ var UserInputs = { }, // Direction arrows processKeyboardArrowKeys(key) { - var DAS = 50.0; - var ARR = 20.0; + var DAS = 20.0; + var ARR = 10.0; if(this.prevKeyboardKeys[key] != this.keyboardKeys[key]) { @@ -888,7 +888,7 @@ Tetris.prototype = { }, // Bind game events _initEvents: function() { - window.addEventListener('keydown', utils.proxy(this._keydownHandler, this), false); + //window.addEventListener('keydown', utils.proxy(this._keydownHandler, this), false); views.btnRestart.addEventListener('click', utils.proxy(this._restartHandler, this), false); }, @@ -944,8 +944,8 @@ Tetris.prototype = { }, _processInput: async function(deltaTime) { - var tenthOfFrame = 1.6//1;//1.6; // 1.6ms = 1 fram - var halfFrame = 8.0//5;//8.0; + var tenthOfFrame = 1.0//1;//1.6; // 1.6ms = 1 fram + var halfFrame = 5.0//5;//8.0; var halfFramePlus = 10.0;//10.0; // TODO: put in web worker--limited to 60fps here @@ -1102,18 +1102,18 @@ Tetris.prototype = { var deltaCounterTime = 0; // Process input as many times as possible in a frame--60hz hopefully - while(deltaCounterTime <= 16) { // 16.666ms = 1 frame + /*while(deltaCounterTime <= 16) { // 16.666ms = 1 frame deltaCounterTime = curInputTime - prevCounterTime; deltaInputTime = curInputTime - this.prevInputTime; this._processInput(deltaInputTime); await this.sleep(1); curInputTime = new Date().getTime(); - } + }*/ this.prevInputTime = curInputTime; var deltaLevelTime = this.currentTime - this.prevTime; - + this._processInput(deltaLevelTime); //if(deltaGameTime < 16) this._refresh(); @@ -1134,9 +1134,10 @@ Tetris.prototype = { }, _checkHint: function() { - if(this.shape.y != this.hintMino.y || this.shape.x != this.hintMino.x) - //1console.log("success!"); - this._restartHandler(); + if(this.shape.y != this.hintMino.y || this.shape.x != this.hintMino.x) { + new Audio('./dist/Failed.ogg').play(); + this._restartHandler(); + } }, // Update game data _update: function() { diff --git a/src/input.js b/src/input.js index c066385..c7e37bb 100644 --- a/src/input.js +++ b/src/input.js @@ -76,8 +76,8 @@ var UserInputs = { // Direction Pad gamepadDPadDown(finds) { - var DAS = 30.0; - var ARR = 20.0; + var DAS = 15.0; + var ARR = 8.0; var isContained = this.gpButtons.includes(finds); var isPrevContained = this.prevGpButtons.includes(finds); @@ -156,8 +156,8 @@ var UserInputs = { }, // Direction arrows processKeyboardArrowKeys(key) { - var DAS = 50.0; - var ARR = 20.0; + var DAS = 20.0; + var ARR = 10.0; if(this.prevKeyboardKeys[key] != this.keyboardKeys[key]) { diff --git a/src/main.js b/src/main.js index e04e67e..fcac23c 100644 --- a/src/main.js +++ b/src/main.js @@ -237,7 +237,7 @@ Tetris.prototype = { }, // Bind game events _initEvents: function() { - window.addEventListener('keydown', utils.proxy(this._keydownHandler, this), false); + //window.addEventListener('keydown', utils.proxy(this._keydownHandler, this), false); views.btnRestart.addEventListener('click', utils.proxy(this._restartHandler, this), false); }, @@ -293,8 +293,8 @@ Tetris.prototype = { }, _processInput: async function(deltaTime) { - var tenthOfFrame = 1.6//1;//1.6; // 1.6ms = 1 fram - var halfFrame = 8.0//5;//8.0; + var tenthOfFrame = 1.0//1;//1.6; // 1.6ms = 1 fram + var halfFrame = 5.0//5;//8.0; var halfFramePlus = 10.0;//10.0; // TODO: put in web worker--limited to 60fps here @@ -451,18 +451,18 @@ Tetris.prototype = { var deltaCounterTime = 0; // Process input as many times as possible in a frame--60hz hopefully - while(deltaCounterTime <= 16) { // 16.666ms = 1 frame + /*while(deltaCounterTime <= 16) { // 16.666ms = 1 frame deltaCounterTime = curInputTime - prevCounterTime; deltaInputTime = curInputTime - this.prevInputTime; this._processInput(deltaInputTime); await this.sleep(1); curInputTime = new Date().getTime(); - } + }*/ this.prevInputTime = curInputTime; var deltaLevelTime = this.currentTime - this.prevTime; - + this._processInput(deltaLevelTime); //if(deltaGameTime < 16) this._refresh(); @@ -483,9 +483,10 @@ Tetris.prototype = { }, _checkHint: function() { - if(this.shape.y != this.hintMino.y || this.shape.x != this.hintMino.x) - //1console.log("success!"); - this._restartHandler(); + if(this.shape.y != this.hintMino.y || this.shape.x != this.hintMino.x) { + new Audio('./dist/Failed.ogg').play(); + this._restartHandler(); + } }, // Update game data _update: function() {