regressions

This commit is contained in:
PolicyChanges1@gmail.com 2021-02-27 16:19:34 -05:00
parent bf1bb122ca
commit f6180db2fb
3 changed files with 20 additions and 20 deletions

20
dist/tetrion.js vendored
View File

@ -925,7 +925,7 @@ Tetris.prototype = {
this.score = 0; this.score = 0;
this.lines = 0; this.lines = 0;
// beginning of frame // beginning of frame
this.startTime = new Date(); this.startTime = new Date().getTime();
this.currentTime = this.startTime; this.currentTime = this.startTime;
this.prevTime = this.startTime; this.prevTime = this.startTime;
//todo:get rid of extra //todo:get rid of extra
@ -962,7 +962,7 @@ Tetris.prototype = {
//Pause game //Pause game
pause: function() { pause: function() {
this.running = false; this.running = false;
this.currentTime = new Date(); this.currentTime = new Date().getTime();
this.prevTime = this.currentTime; this.prevTime = this.currentTime;
}, },
pushHoldStack: function() pushHoldStack: function()
@ -1113,12 +1113,12 @@ Tetris.prototype = {
while((inputs.gamepadQueue != undefined && inputs.gamepadQueue.length >= 1)){ while((inputs.gamepadQueue != undefined && inputs.gamepadQueue.length >= 1)){
var curkey = inputs.gamepadQueue.shift(); var curkey = inputs.gamepadQueue.shift();
if(curkey == "DPad-Left") { if(curkey == "DPad-Left") {
this.shape.goLeft(this.matrix, this.minoShiftSound); this.shape.goLeft(this.matrix);
this.resetLockdown(); this.resetLockdown();
this._draw(); this._draw();
} }
if(curkey == "DPad-Right") { if(curkey == "DPad-Right") {
this.shape.goRight(this.matrix, this.minoShiftSound); this.shape.goRight(this.matrix);
this.resetLockdown(); this.resetLockdown();
this._draw(); this._draw();
} }
@ -1173,12 +1173,12 @@ Tetris.prototype = {
while((inputs.inputqueue != undefined && inputs.inputqueue.length >= 1)){ while((inputs.inputqueue != undefined && inputs.inputqueue.length >= 1)){
var curkey = inputs.inputqueue.shift(); var curkey = inputs.inputqueue.shift();
if(curkey == 37) { if(curkey == 37) {
this.shape.goLeft(this.matrix, this.minoShiftSound); this.shape.goLeft(this.matrix);
this.resetLockdown(); this.resetLockdown();
this._draw(); this._draw();
} }
if(curkey == 39){ if(curkey == 39){
this.shape.goRight(this.matrix, this.minoShiftSound); this.shape.goRight(this.matrix);
this.resetLockdown(); this.resetLockdown();
this._draw(); this._draw();
} }
@ -1238,7 +1238,7 @@ Tetris.prototype = {
if (!this.running) if (!this.running)
return; return;
this.currentTime = new Date(); this.currentTime = new Date().getTime();
var deltaLevelTime = this.currentTime - this.prevTime; var deltaLevelTime = this.currentTime - this.prevTime;
if (deltaLevelTime > this.interval) { // every .6 seconds? if (deltaLevelTime > this.interval) { // every .6 seconds?
this._update(); this._update();
@ -1259,7 +1259,7 @@ Tetris.prototype = {
return; return;
if(!this.shape.isSameSRS(this.hintMino)) if(!this.shape.isSameSRS(this.hintMino))
{ {
new Audio('./dist/Failed.ogg'); new Audio('./dist/Failed.ogg').play();
this._restartHandler(); this._restartHandler();
// Restart // Restart
return 1; return 1;
@ -2593,14 +2593,14 @@ ShapeZR.prototype = {
} }
}, },
//Move the shape to the left //Move the shape to the left
goLeft: function(matrix, sound) { goLeft: function(matrix) {
if (isShapeCanMove(this, matrix, 'left')) { if (isShapeCanMove(this, matrix, 'left')) {
new Audio('./dist/Click.ogg').play(); new Audio('./dist/Click.ogg').play();
this.x -= 1; this.x -= 1;
} }
}, },
//Move the shape to the right //Move the shape to the right
goRight: function(matrix, sound) { goRight: function(matrix) {
if (isShapeCanMove(this, matrix, 'right')) { if (isShapeCanMove(this, matrix, 'right')) {
new Audio('./dist/Click.ogg').play(); new Audio('./dist/Click.ogg').play();
this.x += 1; this.x += 1;

View File

@ -224,7 +224,7 @@ Tetris.prototype = {
this.score = 0; this.score = 0;
this.lines = 0; this.lines = 0;
// beginning of frame // beginning of frame
this.startTime = new Date(); this.startTime = new Date().getTime();
this.currentTime = this.startTime; this.currentTime = this.startTime;
this.prevTime = this.startTime; this.prevTime = this.startTime;
//todo:get rid of extra //todo:get rid of extra
@ -261,7 +261,7 @@ Tetris.prototype = {
//Pause game //Pause game
pause: function() { pause: function() {
this.running = false; this.running = false;
this.currentTime = new Date(); this.currentTime = new Date().getTime();
this.prevTime = this.currentTime; this.prevTime = this.currentTime;
}, },
pushHoldStack: function() pushHoldStack: function()
@ -412,12 +412,12 @@ Tetris.prototype = {
while((inputs.gamepadQueue != undefined && inputs.gamepadQueue.length >= 1)){ while((inputs.gamepadQueue != undefined && inputs.gamepadQueue.length >= 1)){
var curkey = inputs.gamepadQueue.shift(); var curkey = inputs.gamepadQueue.shift();
if(curkey == "DPad-Left") { if(curkey == "DPad-Left") {
this.shape.goLeft(this.matrix, this.minoShiftSound); this.shape.goLeft(this.matrix);
this.resetLockdown(); this.resetLockdown();
this._draw(); this._draw();
} }
if(curkey == "DPad-Right") { if(curkey == "DPad-Right") {
this.shape.goRight(this.matrix, this.minoShiftSound); this.shape.goRight(this.matrix);
this.resetLockdown(); this.resetLockdown();
this._draw(); this._draw();
} }
@ -472,12 +472,12 @@ Tetris.prototype = {
while((inputs.inputqueue != undefined && inputs.inputqueue.length >= 1)){ while((inputs.inputqueue != undefined && inputs.inputqueue.length >= 1)){
var curkey = inputs.inputqueue.shift(); var curkey = inputs.inputqueue.shift();
if(curkey == 37) { if(curkey == 37) {
this.shape.goLeft(this.matrix, this.minoShiftSound); this.shape.goLeft(this.matrix);
this.resetLockdown(); this.resetLockdown();
this._draw(); this._draw();
} }
if(curkey == 39){ if(curkey == 39){
this.shape.goRight(this.matrix, this.minoShiftSound); this.shape.goRight(this.matrix);
this.resetLockdown(); this.resetLockdown();
this._draw(); this._draw();
} }
@ -537,7 +537,7 @@ Tetris.prototype = {
if (!this.running) if (!this.running)
return; return;
this.currentTime = new Date(); this.currentTime = new Date().getTime();
var deltaLevelTime = this.currentTime - this.prevTime; var deltaLevelTime = this.currentTime - this.prevTime;
if (deltaLevelTime > this.interval) { // every .6 seconds? if (deltaLevelTime > this.interval) { // every .6 seconds?
this._update(); this._update();
@ -558,7 +558,7 @@ Tetris.prototype = {
return; return;
if(!this.shape.isSameSRS(this.hintMino)) if(!this.shape.isSameSRS(this.hintMino))
{ {
new Audio('./dist/Failed.ogg'); new Audio('./dist/Failed.ogg').play();
this._restartHandler(); this._restartHandler();
// Restart // Restart
return 1; return 1;

View File

@ -792,14 +792,14 @@ ShapeZR.prototype = {
} }
}, },
//Move the shape to the left //Move the shape to the left
goLeft: function(matrix, sound) { goLeft: function(matrix) {
if (isShapeCanMove(this, matrix, 'left')) { if (isShapeCanMove(this, matrix, 'left')) {
new Audio('./dist/Click.ogg').play(); new Audio('./dist/Click.ogg').play();
this.x -= 1; this.x -= 1;
} }
}, },
//Move the shape to the right //Move the shape to the right
goRight: function(matrix, sound) { goRight: function(matrix) {
if (isShapeCanMove(this, matrix, 'right')) { if (isShapeCanMove(this, matrix, 'right')) {
new Audio('./dist/Click.ogg').play(); new Audio('./dist/Click.ogg').play();
this.x += 1; this.x += 1;