diff --git a/dist/Blop2.ogg b/dist/Blop2.ogg new file mode 100644 index 0000000..1472d95 Binary files /dev/null and b/dist/Blop2.ogg differ diff --git a/dist/Click.ogg b/dist/Click.ogg new file mode 100644 index 0000000..e40f4d3 Binary files /dev/null and b/dist/Click.ogg differ diff --git a/dist/tetrion.js b/dist/tetrion.js index 86c330c..595b93f 100644 --- a/dist/tetrion.js +++ b/dist/tetrion.js @@ -486,7 +486,7 @@ var UserInputs = { } else { if (gamepadDASFrames >= deciARR && isContained) { - this.gamepadQueue.push(finds); + //this.gamepadQueue.push(finds); this.gamepadButtonsDeciFrames = 0; } } @@ -495,16 +495,16 @@ var UserInputs = { // Direction Pad gamepadDPadDown(finds) { - var DAS = 7.0; - var ARR = 3.0; + var DAS = 10.0; + var ARR = 5.0; var isContained = this.gpButtons.includes(finds); var isPrevContained = this.prevGpButtons.includes(finds); //console.log("but: " + this.gpButtons + " prev but:" + this.prevGpButtons); if(isPrevContained != isContained ) { this.isGamepadDown = false; // Do once - //if(isContained) - // this.gamepadQueue.push(finds); + if(isContained) + this.gamepadQueue.push(finds); } var gamepadDirectionDasFrames = this.gamepadDirectionPadDeciFrames / 1.0; if (!this.isGamepadDown) { @@ -556,7 +556,7 @@ var UserInputs = { } } else { if (keyboardDASFrames >= deciARR && this.keyboardKeys[key] == true) { - this.inputqueue.push(key); + //this.inputqueue.push(key); this.keyboardButtonsDeciframes = 0; } } @@ -572,16 +572,16 @@ var UserInputs = { }, // Direction arrows processKeyboardArrowKeys(key) { - var DAS = 8.0; + var DAS = 30.0; var ARR = 0.0; - /* do once? + if(this.prevKeyboardKeys[key] != this.keyboardKeys[key]) { this.isDirectionArrowDown = false; if(this.keyboardKeys[key] == true) this.inputqueue.push(key); } - */ + //console.log(key + " " + this.held var keyboardDASFrames = this.keyboardDirectionArrowsDeciframes / 1.0; // why isnt this 10? //console.log(keyboardDASFrames + " " + this.held); @@ -820,7 +820,7 @@ Tetris.prototype = { this.levelTime = this.startTime; this.shapeQueue = this.shapeQueue || []; this.hintQueue = this.hintQueue || []; - this.holdQueue = this.holdQueue || []; + this.holdQueue = []; this.canPullFromHoldQueue = false; clearMatrix(this.matrix); views.setLevel(this.level); @@ -887,16 +887,17 @@ Tetris.prototype = { _fireShape: function() { //this.shape = this.shapeQueue.shift() || shapes.randomShape(); + while(this.shapeQueue.length <= 4) { - this.preparedShape = shapes.randomShape();//openers.getNextMino(); + this.preparedShape = openers.getNextMino(); this.shapeQueue.push(this.preparedShape); } - /*while(this.hintQueue.length <= 4) + while(this.hintQueue.length <= 4) { this.preparedShape = openers.getNextHint(this.matrix); this.hintQueue.push(this.preparedShape); - }*/ + } //this.hintMino = this.hintQueue.shift(); this.shape = this.shapeQueue.shift();// shapes.randomShape(); @@ -1030,10 +1031,10 @@ Tetris.prototype = { this._update(); } if(curkey == 81) { - //if(document.getElementById("bg").style.display == "none") - // document.getElementById("bg").style.display = "initial"; - //else - // document.getElementById("bg").style.display="none"; + if(document.getElementById("bg").style.display == "none") + document.getElementById("bg").style.display = "initial"; + else + document.getElementById("bg").style.display="none"; } } inputs.inputqueue = []; @@ -1067,7 +1068,7 @@ Tetris.prototype = { this.shape.copyTo(this.matrix); this._check(); this._fireShape(); - new Audio('./dist/Blop.ogg').play(); + new Audio('./dist/Blop2.ogg').play(); } this._draw(); this.isGameOver = checkGameOver(this.matrix); @@ -1641,12 +1642,14 @@ ShapeZR.prototype = { //Move the shape to the left goLeft: function(matrix) { if (isShapeCanMove(this, matrix, 'left')) { + new Audio('./dist/Click.ogg').play(); this.x -= 1; } }, //Move the shape to the right goRight: function(matrix) { if (isShapeCanMove(this, matrix, 'right')) { + new Audio('./dist/Click.ogg').play(); this.x += 1; } }, diff --git a/index.html b/index.html index e7c1361..f653271 100644 --- a/index.html +++ b/index.html @@ -37,13 +37,13 @@ - +document.getElementById("bg").height = window.innerHeight;
diff --git a/src/input.js b/src/input.js index 2f00396..db241b6 100644 --- a/src/input.js +++ b/src/input.js @@ -66,7 +66,7 @@ var UserInputs = { } else { if (gamepadDASFrames >= deciARR && isContained) { - this.gamepadQueue.push(finds); + //this.gamepadQueue.push(finds); this.gamepadButtonsDeciFrames = 0; } } @@ -75,16 +75,16 @@ var UserInputs = { // Direction Pad gamepadDPadDown(finds) { - var DAS = 7.0; - var ARR = 3.0; + var DAS = 10.0; + var ARR = 5.0; var isContained = this.gpButtons.includes(finds); var isPrevContained = this.prevGpButtons.includes(finds); //console.log("but: " + this.gpButtons + " prev but:" + this.prevGpButtons); if(isPrevContained != isContained ) { this.isGamepadDown = false; // Do once - //if(isContained) - // this.gamepadQueue.push(finds); + if(isContained) + this.gamepadQueue.push(finds); } var gamepadDirectionDasFrames = this.gamepadDirectionPadDeciFrames / 1.0; if (!this.isGamepadDown) { @@ -136,7 +136,7 @@ var UserInputs = { } } else { if (keyboardDASFrames >= deciARR && this.keyboardKeys[key] == true) { - this.inputqueue.push(key); + //this.inputqueue.push(key); this.keyboardButtonsDeciframes = 0; } } @@ -152,16 +152,16 @@ var UserInputs = { }, // Direction arrows processKeyboardArrowKeys(key) { - var DAS = 8.0; + var DAS = 30.0; var ARR = 0.0; - /* do once? + if(this.prevKeyboardKeys[key] != this.keyboardKeys[key]) { this.isDirectionArrowDown = false; if(this.keyboardKeys[key] == true) this.inputqueue.push(key); } - */ + //console.log(key + " " + this.held var keyboardDASFrames = this.keyboardDirectionArrowsDeciframes / 1.0; // why isnt this 10? //console.log(keyboardDASFrames + " " + this.held); diff --git a/src/main.js b/src/main.js index 1068e12..22a46b8 100644 --- a/src/main.js +++ b/src/main.js @@ -175,7 +175,7 @@ Tetris.prototype = { this.levelTime = this.startTime; this.shapeQueue = this.shapeQueue || []; this.hintQueue = this.hintQueue || []; - this.holdQueue = this.holdQueue || []; + this.holdQueue = []; this.canPullFromHoldQueue = false; clearMatrix(this.matrix); views.setLevel(this.level); @@ -242,16 +242,17 @@ Tetris.prototype = { _fireShape: function() { //this.shape = this.shapeQueue.shift() || shapes.randomShape(); + while(this.shapeQueue.length <= 4) { - this.preparedShape = shapes.randomShape();//openers.getNextMino(); + this.preparedShape = openers.getNextMino(); this.shapeQueue.push(this.preparedShape); } - /*while(this.hintQueue.length <= 4) + while(this.hintQueue.length <= 4) { this.preparedShape = openers.getNextHint(this.matrix); this.hintQueue.push(this.preparedShape); - }*/ + } //this.hintMino = this.hintQueue.shift(); this.shape = this.shapeQueue.shift();// shapes.randomShape(); @@ -385,10 +386,10 @@ Tetris.prototype = { this._update(); } if(curkey == 81) { - //if(document.getElementById("bg").style.display == "none") - // document.getElementById("bg").style.display = "initial"; - //else - // document.getElementById("bg").style.display="none"; + if(document.getElementById("bg").style.display == "none") + document.getElementById("bg").style.display = "initial"; + else + document.getElementById("bg").style.display="none"; } } inputs.inputqueue = []; @@ -422,7 +423,7 @@ Tetris.prototype = { this.shape.copyTo(this.matrix); this._check(); this._fireShape(); - new Audio('./dist/Blop.ogg').play(); + new Audio('./dist/Blop2.ogg').play(); } this._draw(); this.isGameOver = checkGameOver(this.matrix); diff --git a/src/openers b/src/openers deleted file mode 100644 index 0b6940a..0000000 --- a/src/openers +++ /dev/null @@ -1,31 +0,0 @@ -shapes = require(./shapes.js); - - -function TKI3FonzieVariation { - - this.shapeQueue: [], - -} - -TKI3FonzieVariation.prototype = { - init: function () { - this.shapeQueue.push(new ShapeL()); - this.shapeQueue.push(new ShapeI()); - this.shapeQueue.push(new ShapeO()); - this.shapeQueue.push(new ShapeS()); - this.shapeQueue.push(new ShapeZ()); - this.shapeQueue.push(new ShapeJ()); - this.shapeQueue.push(new ShapeT()); - } - - //hintShape -} - -function getNewOpener() -{ - var opener = new TKI3FonzieVariation() - opener.init(); - return opener; -} -//var Openers = { - diff --git a/src/shapes.js b/src/shapes.js index e8b59bf..65cf09a 100644 --- a/src/shapes.js +++ b/src/shapes.js @@ -360,12 +360,14 @@ ShapeZR.prototype = { //Move the shape to the left goLeft: function(matrix) { if (isShapeCanMove(this, matrix, 'left')) { + new Audio('./dist/Click.ogg').play(); this.x -= 1; } }, //Move the shape to the right goRight: function(matrix) { if (isShapeCanMove(this, matrix, 'right')) { + new Audio('./dist/Click.ogg').play(); this.x += 1; } },