sound, etc
parent
6126e92cac
commit
795df85122
|
@ -6,7 +6,7 @@ nav ul{height:200px; width:80%;}
|
||||||
nav ul{overflow:hidden; overflow-y:scroll;}
|
nav ul{overflow:hidden; overflow-y:scroll;}
|
||||||
|
|
||||||
body{
|
body{
|
||||||
background: #3f3f3f;
|
background: #000000;
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
Binary file not shown.
|
@ -496,8 +496,8 @@ var UserInputs = {
|
||||||
|
|
||||||
// Direction Pad
|
// Direction Pad
|
||||||
gamepadDPadDown(finds) {
|
gamepadDPadDown(finds) {
|
||||||
var DAS = 30.0;
|
var DAS = 15.0;
|
||||||
var ARR = 20.0;
|
var ARR = 8.0;
|
||||||
var isContained = this.gpButtons.includes(finds);
|
var isContained = this.gpButtons.includes(finds);
|
||||||
var isPrevContained = this.prevGpButtons.includes(finds);
|
var isPrevContained = this.prevGpButtons.includes(finds);
|
||||||
|
|
||||||
|
@ -576,8 +576,8 @@ var UserInputs = {
|
||||||
},
|
},
|
||||||
// Direction arrows
|
// Direction arrows
|
||||||
processKeyboardArrowKeys(key) {
|
processKeyboardArrowKeys(key) {
|
||||||
var DAS = 50.0;
|
var DAS = 20.0;
|
||||||
var ARR = 20.0;
|
var ARR = 10.0;
|
||||||
|
|
||||||
|
|
||||||
if(this.prevKeyboardKeys[key] != this.keyboardKeys[key]) {
|
if(this.prevKeyboardKeys[key] != this.keyboardKeys[key]) {
|
||||||
|
@ -888,7 +888,7 @@ Tetris.prototype = {
|
||||||
},
|
},
|
||||||
// Bind game events
|
// Bind game events
|
||||||
_initEvents: function() {
|
_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);
|
views.btnRestart.addEventListener('click', utils.proxy(this._restartHandler, this), false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -944,8 +944,8 @@ Tetris.prototype = {
|
||||||
},
|
},
|
||||||
_processInput: async function(deltaTime) {
|
_processInput: async function(deltaTime) {
|
||||||
|
|
||||||
var tenthOfFrame = 1.6//1;//1.6; // 1.6ms = 1 fram
|
var tenthOfFrame = 1.0//1;//1.6; // 1.6ms = 1 fram
|
||||||
var halfFrame = 8.0//5;//8.0;
|
var halfFrame = 5.0//5;//8.0;
|
||||||
var halfFramePlus = 10.0;//10.0;
|
var halfFramePlus = 10.0;//10.0;
|
||||||
|
|
||||||
// TODO: put in web worker--limited to 60fps here
|
// TODO: put in web worker--limited to 60fps here
|
||||||
|
@ -1102,18 +1102,18 @@ Tetris.prototype = {
|
||||||
var deltaCounterTime = 0;
|
var deltaCounterTime = 0;
|
||||||
|
|
||||||
// Process input as many times as possible in a frame--60hz hopefully
|
// 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;
|
deltaCounterTime = curInputTime - prevCounterTime;
|
||||||
deltaInputTime = curInputTime - this.prevInputTime;
|
deltaInputTime = curInputTime - this.prevInputTime;
|
||||||
this._processInput(deltaInputTime);
|
this._processInput(deltaInputTime);
|
||||||
await this.sleep(1);
|
await this.sleep(1);
|
||||||
curInputTime = new Date().getTime();
|
curInputTime = new Date().getTime();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
this.prevInputTime = curInputTime;
|
this.prevInputTime = curInputTime;
|
||||||
var deltaLevelTime = this.currentTime - this.prevTime;
|
var deltaLevelTime = this.currentTime - this.prevTime;
|
||||||
|
|
||||||
|
this._processInput(deltaLevelTime);
|
||||||
|
|
||||||
|
|
||||||
//if(deltaGameTime < 16) this._refresh();
|
//if(deltaGameTime < 16) this._refresh();
|
||||||
|
@ -1134,9 +1134,10 @@ Tetris.prototype = {
|
||||||
|
|
||||||
},
|
},
|
||||||
_checkHint: function() {
|
_checkHint: function() {
|
||||||
if(this.shape.y != this.hintMino.y || this.shape.x != this.hintMino.x)
|
if(this.shape.y != this.hintMino.y || this.shape.x != this.hintMino.x) {
|
||||||
//1console.log("success!");
|
new Audio('./dist/Failed.ogg').play();
|
||||||
this._restartHandler();
|
this._restartHandler();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// Update game data
|
// Update game data
|
||||||
_update: function() {
|
_update: function() {
|
||||||
|
|
|
@ -76,8 +76,8 @@ var UserInputs = {
|
||||||
|
|
||||||
// Direction Pad
|
// Direction Pad
|
||||||
gamepadDPadDown(finds) {
|
gamepadDPadDown(finds) {
|
||||||
var DAS = 30.0;
|
var DAS = 15.0;
|
||||||
var ARR = 20.0;
|
var ARR = 8.0;
|
||||||
var isContained = this.gpButtons.includes(finds);
|
var isContained = this.gpButtons.includes(finds);
|
||||||
var isPrevContained = this.prevGpButtons.includes(finds);
|
var isPrevContained = this.prevGpButtons.includes(finds);
|
||||||
|
|
||||||
|
@ -156,8 +156,8 @@ var UserInputs = {
|
||||||
},
|
},
|
||||||
// Direction arrows
|
// Direction arrows
|
||||||
processKeyboardArrowKeys(key) {
|
processKeyboardArrowKeys(key) {
|
||||||
var DAS = 50.0;
|
var DAS = 20.0;
|
||||||
var ARR = 20.0;
|
var ARR = 10.0;
|
||||||
|
|
||||||
|
|
||||||
if(this.prevKeyboardKeys[key] != this.keyboardKeys[key]) {
|
if(this.prevKeyboardKeys[key] != this.keyboardKeys[key]) {
|
||||||
|
|
19
src/main.js
19
src/main.js
|
@ -237,7 +237,7 @@ Tetris.prototype = {
|
||||||
},
|
},
|
||||||
// Bind game events
|
// Bind game events
|
||||||
_initEvents: function() {
|
_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);
|
views.btnRestart.addEventListener('click', utils.proxy(this._restartHandler, this), false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -293,8 +293,8 @@ Tetris.prototype = {
|
||||||
},
|
},
|
||||||
_processInput: async function(deltaTime) {
|
_processInput: async function(deltaTime) {
|
||||||
|
|
||||||
var tenthOfFrame = 1.6//1;//1.6; // 1.6ms = 1 fram
|
var tenthOfFrame = 1.0//1;//1.6; // 1.6ms = 1 fram
|
||||||
var halfFrame = 8.0//5;//8.0;
|
var halfFrame = 5.0//5;//8.0;
|
||||||
var halfFramePlus = 10.0;//10.0;
|
var halfFramePlus = 10.0;//10.0;
|
||||||
|
|
||||||
// TODO: put in web worker--limited to 60fps here
|
// TODO: put in web worker--limited to 60fps here
|
||||||
|
@ -451,18 +451,18 @@ Tetris.prototype = {
|
||||||
var deltaCounterTime = 0;
|
var deltaCounterTime = 0;
|
||||||
|
|
||||||
// Process input as many times as possible in a frame--60hz hopefully
|
// 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;
|
deltaCounterTime = curInputTime - prevCounterTime;
|
||||||
deltaInputTime = curInputTime - this.prevInputTime;
|
deltaInputTime = curInputTime - this.prevInputTime;
|
||||||
this._processInput(deltaInputTime);
|
this._processInput(deltaInputTime);
|
||||||
await this.sleep(1);
|
await this.sleep(1);
|
||||||
curInputTime = new Date().getTime();
|
curInputTime = new Date().getTime();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
this.prevInputTime = curInputTime;
|
this.prevInputTime = curInputTime;
|
||||||
var deltaLevelTime = this.currentTime - this.prevTime;
|
var deltaLevelTime = this.currentTime - this.prevTime;
|
||||||
|
|
||||||
|
this._processInput(deltaLevelTime);
|
||||||
|
|
||||||
|
|
||||||
//if(deltaGameTime < 16) this._refresh();
|
//if(deltaGameTime < 16) this._refresh();
|
||||||
|
@ -483,9 +483,10 @@ Tetris.prototype = {
|
||||||
|
|
||||||
},
|
},
|
||||||
_checkHint: function() {
|
_checkHint: function() {
|
||||||
if(this.shape.y != this.hintMino.y || this.shape.x != this.hintMino.x)
|
if(this.shape.y != this.hintMino.y || this.shape.x != this.hintMino.x) {
|
||||||
//1console.log("success!");
|
new Audio('./dist/Failed.ogg').play();
|
||||||
this._restartHandler();
|
this._restartHandler();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// Update game data
|
// Update game data
|
||||||
_update: function() {
|
_update: function() {
|
||||||
|
|
Loading…
Reference in New Issue