add dt cannon

This commit is contained in:
PolicyChanges1@gmail.com 2021-02-21 23:01:28 -05:00
parent cd7874b1d7
commit af1c9149d2
4 changed files with 258 additions and 27 deletions

137
dist/tetrion.js vendored
View File

@ -940,7 +940,7 @@ Tetris.prototype = {
canvas.drawShape(this.shape); canvas.drawShape(this.shape);
canvas.drawHoldShape(this.holdQueue); canvas.drawHoldShape(this.holdQueue);
canvas.drawPreviewShape(this.shapeQueue); canvas.drawPreviewShape(this.shapeQueue);
//canvas.drawHintShape(this.hintMino); canvas.drawHintShape(this.hintMino);
if(this.shape != undefined) { if(this.shape != undefined) {
let clone = Object.assign(Object.create(Object.getPrototypeOf(this.shape)), this.shape); let clone = Object.assign(Object.create(Object.getPrototypeOf(this.shape)), this.shape);
@ -963,12 +963,11 @@ Tetris.prototype = {
var halfFrame = 5.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
//if(deltaTime >= tenthOfFrame) { // needs to be 600hz // 16 / 10
inputs.incDeciframes();
inputs.incTickCounter();
//}
inputs.incDeciframes();
inputs.incTickCounter();
if(inputs.getTickCounter() >= tenthOfFrame) { if(inputs.getTickCounter() >= tenthOfFrame) {
inputs.updateGamepad(); inputs.updateGamepad();
inputs.processGamepadDPad(); inputs.processGamepadDPad();
@ -1153,6 +1152,7 @@ Tetris.prototype = {
if(!this.shape.isSameSRS(this.hintMino)) if(!this.shape.isSameSRS(this.hintMino))
{ {
new Audio('./dist/Failed.ogg').play();
this._restartHandler(); this._restartHandler();
} }
/*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) {
@ -1169,7 +1169,7 @@ Tetris.prototype = {
this.canPullFromHoldQueue = true; this.canPullFromHoldQueue = true;
this.shape.copyTo(this.matrix); this.shape.copyTo(this.matrix);
this._check(); this._check();
//this._checkHint(); this._checkHint();
this._fireShape(); this._fireShape();
new Audio('./dist/Blop2.ogg').play(); new Audio('./dist/Blop2.ogg').play();
} }
@ -1308,7 +1308,8 @@ TKI3FonzieVariation.prototype = {
} }
*/ */
// L O Z T LR ZR I
// L O Z T LR/J ZR/S I
var OpenerGenerator = { var OpenerGenerator = {
shapeQueue: [], shapeQueue: [],
hintQueue: [], hintQueue: [],
@ -1319,12 +1320,28 @@ var OpenerGenerator = {
init() { init() {
if(!this.isInit || this.shapeQueue == undefined) { if(!this.isInit || this.shapeQueue == undefined) {
this.shapeQueue = new Array( this.shapeQueue = new Array(
/*
shapes.getShape(0), shapes.getShape(0),
shapes.getShape(6), shapes.getShape(6),
shapes.getShape(1), shapes.getShape(1),
shapes.getShape(5), shapes.getShape(5),
shapes.getShape(2), shapes.getShape(2),
shapes.getShape(4), shapes.getShape(4),
shapes.getShape(3));*/
// O I L S J Z T O I L J T O T
shapes.getShape(1),
shapes.getShape(6),
shapes.getShape(0),
shapes.getShape(5),
shapes.getShape(4),
shapes.getShape(2),
shapes.getShape(3),
shapes.getShape(1),
shapes.getShape(6),
shapes.getShape(0),
shapes.getShape(4),
shapes.getShape(3),
shapes.getShape(1),
shapes.getShape(3)); shapes.getShape(3));
} }
this.isInit = 1; this.isInit = 1;
@ -1336,7 +1353,7 @@ var OpenerGenerator = {
this.init(); this.init();
var mino = this.shapeQueue[this.idx]; var mino = this.shapeQueue[this.idx];
this.idx++; this.idx++;
if(this.idx == 7) { if(this.idx == this.shapeQueue.length) {
this.idx = 0; this.idx = 0;
this.isInit = 0; this.isInit = 0;
} }
@ -1344,7 +1361,7 @@ var OpenerGenerator = {
return mino; return mino;
}, },
// L O Z T LR ZR I // L O Z T LR ZR I
initHint(matrix) { /* initHint(matrix) {
if(!this.isHintInit || this.hintQueue == undefined) { if(!this.isHintInit || this.hintQueue == undefined) {
this.hintQueue = new Array( this.hintQueue = new Array(
shapes.getShape(0), shapes.getShape(0),
@ -1387,13 +1404,111 @@ var OpenerGenerator = {
this.isHintInit = 1; this.isHintInit = 1;
return;
},*/
// L O Z T LR ZR I
initHint(matrix) {
if(!this.isHintInit || this.hintQueue == undefined) {
this.hintQueue = new Array(
/*shapes.getShape(0),
shapes.getShape(6),
shapes.getShape(1),
shapes.getShape(5),
shapes.getShape(2),
shapes.getShape(4),
shapes.getShape(3)
*/
shapes.getShape(1),
shapes.getShape(6),
shapes.getShape(0),
shapes.getShape(5),
shapes.getShape(4),
shapes.getShape(2),
shapes.getShape(3),
shapes.getShape(1),
shapes.getShape(6),
shapes.getShape(0),
shapes.getShape(4),
shapes.getShape(3),
shapes.getShape(1),
shapes.getShape(3));
// O I L S J Z T O I L J T O T
// O
this.hintQueue[0].x = -2;
this.hintQueue[0].y = 18;
// I
this.hintQueue[1].x = 6;
this.hintQueue[1].y = 16;
//this.hintQueue[1].state = this.hintQueue[1].nextState(1);
// L
this.hintQueue[2].x = 6;
this.hintQueue[2].y = 17;
this.hintQueue[2].state = this.hintQueue[2].nextState(1);
// S
this.hintQueue[3].x = 7;
this.hintQueue[3].y = 17;
this.hintQueue[3].state = this.hintQueue[3].nextState(1);
// J
this.hintQueue[4].x = 4;
this.hintQueue[4].y = 17;
this.hintQueue[4].state = this.hintQueue[4].nextState(-1);
// Z
this.hintQueue[5].x = 3;
this.hintQueue[5].y = 17;
this.hintQueue[5].state = this.hintQueue[5].nextState(2);
// T
this.hintQueue[6].x = 3;
this.hintQueue[6].y = 15;
// O
this.hintQueue[7].x = 5;
this.hintQueue[7].y = 15;
// I
this.hintQueue[8].x = 9;
this.hintQueue[8].y = 14;
//this.hintQueue[8].state = this.hintQueue[8].nextState(1);
// L
this.hintQueue[9].x = 2;
this.hintQueue[9].y = 13;
this.hintQueue[9].state = this.hintQueue[9].nextState(-1);
// J
this.hintQueue[10].x = -1;
this.hintQueue[10].y = 15;
this.hintQueue[10].state = this.hintQueue[10].nextState(1);
// T
this.hintQueue[11].x = 1;
this.hintQueue[11].y = 16;
this.hintQueue[11].state = this.hintQueue[11].nextState(2);
// O
this.hintQueue[12].x = 3;
this.hintQueue[12].y = 16;
this.hintQueue[12].state = this.hintQueue[12].nextState(1);
// T
this.hintQueue[13].x = 1;
this.hintQueue[13].y = 17;
this.hintQueue[13].state = this.hintQueue[13].nextState(-1);
}
this.isHintInit = 1;
return; return;
}, },
getNextHint(matrix) { getNextHint(matrix) {
this.initHint(matrix); this.initHint(matrix);
var mino = this.hintQueue[this.hintIdx]; var mino = this.hintQueue[this.hintIdx];
this.hintIdx++; this.hintIdx++;
if(this.hintIdx == 7) { if(this.hintIdx == this.hintQueue.length) {
this.hintIdx = 0; this.hintIdx = 0;
this.isHintInit = 0; this.isHintInit = 0;
} }

View File

@ -39,6 +39,7 @@
<!--https://www.shadertoy.com/embed/wttfW2?gui=&t=10&paused=false&muted=false--> <!--https://www.shadertoy.com/embed/wttfW2?gui=&t=10&paused=false&muted=false-->
<iframe id="bg" width="640" height="360" frameborder="0" src="https://www.shadertoy.com/embed/WldfWX?gui=&t=10&paused=false&muted=false" allowfullscreen></iframe> <iframe id="bg" width="640" height="360" frameborder="0" src="https://www.shadertoy.com/embed/WldfWX?gui=&t=10&paused=false&muted=false" allowfullscreen></iframe>
<script> <script>
@ -56,11 +57,11 @@ document.getElementById("bg").height = window.innerHeight;
<nav> <nav>
<ul> <ul>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">TKI 3 (Fonzie variation) </a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">TKI 3 (Fonzie variation) </a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">TKI 3 (Flat Top variation) </a></li> <!--<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">TKI 3 (Flat Top variation) </a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">TKI 3 (Castle Top variation) </a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">TKI 3 (Castle Top variation) </a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Ajanba TSD </a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Ajanba TSD </a></li> -->
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">DT Cannon (LS / JZ base)</a></li> <li style="font-size:12px";><a href="#" id="setTKIDTCannonVar">DT Cannon (LS / JZ base)</a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">MKO Stacking</a></li> <!--<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">MKO Stacking</a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Pokemino's STD </a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Pokemino's STD </a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Mr. T-Spin's STD (reversed) </a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Mr. T-Spin's STD (reversed) </a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Hachispin</a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Hachispin</a></li>
@ -70,7 +71,7 @@ document.getElementById("bg").height = window.innerHeight;
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">DT Cannon (TSZ base) </a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">DT Cannon (TSZ base) </a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">BT Cannon </a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">BT Cannon </a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">C-Spin </a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">C-Spin </a></li>
<li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Hummingbird</a></li> <li style="font-size:12px";><a href="#" id="setTKIFonzieVar">Hummingbird</a></li>-->
</ul> </ul>
</nav> </nav>

View File

@ -281,7 +281,7 @@ Tetris.prototype = {
canvas.drawShape(this.shape); canvas.drawShape(this.shape);
canvas.drawHoldShape(this.holdQueue); canvas.drawHoldShape(this.holdQueue);
canvas.drawPreviewShape(this.shapeQueue); canvas.drawPreviewShape(this.shapeQueue);
//canvas.drawHintShape(this.hintMino); canvas.drawHintShape(this.hintMino);
if(this.shape != undefined) { if(this.shape != undefined) {
let clone = Object.assign(Object.create(Object.getPrototypeOf(this.shape)), this.shape); let clone = Object.assign(Object.create(Object.getPrototypeOf(this.shape)), this.shape);
@ -304,12 +304,11 @@ Tetris.prototype = {
var halfFrame = 5.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
//if(deltaTime >= tenthOfFrame) { // needs to be 600hz // 16 / 10
inputs.incDeciframes();
inputs.incTickCounter();
//}
inputs.incDeciframes();
inputs.incTickCounter();
if(inputs.getTickCounter() >= tenthOfFrame) { if(inputs.getTickCounter() >= tenthOfFrame) {
inputs.updateGamepad(); inputs.updateGamepad();
inputs.processGamepadDPad(); inputs.processGamepadDPad();
@ -494,6 +493,7 @@ Tetris.prototype = {
if(!this.shape.isSameSRS(this.hintMino)) if(!this.shape.isSameSRS(this.hintMino))
{ {
new Audio('./dist/Failed.ogg').play();
this._restartHandler(); this._restartHandler();
} }
/*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) {
@ -510,7 +510,7 @@ Tetris.prototype = {
this.canPullFromHoldQueue = true; this.canPullFromHoldQueue = true;
this.shape.copyTo(this.matrix); this.shape.copyTo(this.matrix);
this._check(); this._check();
//this._checkHint(); this._checkHint();
this._fireShape(); this._fireShape();
new Audio('./dist/Blop2.ogg').play(); new Audio('./dist/Blop2.ogg').play();
} }

View File

@ -44,7 +44,8 @@ TKI3FonzieVariation.prototype = {
} }
*/ */
// L O Z T LR ZR I
// L O Z T LR/J ZR/S I
var OpenerGenerator = { var OpenerGenerator = {
shapeQueue: [], shapeQueue: [],
hintQueue: [], hintQueue: [],
@ -55,12 +56,28 @@ var OpenerGenerator = {
init() { init() {
if(!this.isInit || this.shapeQueue == undefined) { if(!this.isInit || this.shapeQueue == undefined) {
this.shapeQueue = new Array( this.shapeQueue = new Array(
/*
shapes.getShape(0), shapes.getShape(0),
shapes.getShape(6), shapes.getShape(6),
shapes.getShape(1), shapes.getShape(1),
shapes.getShape(5), shapes.getShape(5),
shapes.getShape(2), shapes.getShape(2),
shapes.getShape(4), shapes.getShape(4),
shapes.getShape(3));*/
// O I L S J Z T O I L J T O T
shapes.getShape(1),
shapes.getShape(6),
shapes.getShape(0),
shapes.getShape(5),
shapes.getShape(4),
shapes.getShape(2),
shapes.getShape(3),
shapes.getShape(1),
shapes.getShape(6),
shapes.getShape(0),
shapes.getShape(4),
shapes.getShape(3),
shapes.getShape(1),
shapes.getShape(3)); shapes.getShape(3));
} }
this.isInit = 1; this.isInit = 1;
@ -72,7 +89,7 @@ var OpenerGenerator = {
this.init(); this.init();
var mino = this.shapeQueue[this.idx]; var mino = this.shapeQueue[this.idx];
this.idx++; this.idx++;
if(this.idx == 7) { if(this.idx == this.shapeQueue.length) {
this.idx = 0; this.idx = 0;
this.isInit = 0; this.isInit = 0;
} }
@ -80,7 +97,7 @@ var OpenerGenerator = {
return mino; return mino;
}, },
// L O Z T LR ZR I // L O Z T LR ZR I
initHint(matrix) { /* initHint(matrix) {
if(!this.isHintInit || this.hintQueue == undefined) { if(!this.isHintInit || this.hintQueue == undefined) {
this.hintQueue = new Array( this.hintQueue = new Array(
shapes.getShape(0), shapes.getShape(0),
@ -123,13 +140,111 @@ var OpenerGenerator = {
this.isHintInit = 1; this.isHintInit = 1;
return;
},*/
// L O Z T LR ZR I
initHint(matrix) {
if(!this.isHintInit || this.hintQueue == undefined) {
this.hintQueue = new Array(
/*shapes.getShape(0),
shapes.getShape(6),
shapes.getShape(1),
shapes.getShape(5),
shapes.getShape(2),
shapes.getShape(4),
shapes.getShape(3)
*/
shapes.getShape(1),
shapes.getShape(6),
shapes.getShape(0),
shapes.getShape(5),
shapes.getShape(4),
shapes.getShape(2),
shapes.getShape(3),
shapes.getShape(1),
shapes.getShape(6),
shapes.getShape(0),
shapes.getShape(4),
shapes.getShape(3),
shapes.getShape(1),
shapes.getShape(3));
// O I L S J Z T O I L J T O T
// O
this.hintQueue[0].x = -2;
this.hintQueue[0].y = 18;
// I
this.hintQueue[1].x = 6;
this.hintQueue[1].y = 16;
//this.hintQueue[1].state = this.hintQueue[1].nextState(1);
// L
this.hintQueue[2].x = 6;
this.hintQueue[2].y = 17;
this.hintQueue[2].state = this.hintQueue[2].nextState(1);
// S
this.hintQueue[3].x = 7;
this.hintQueue[3].y = 17;
this.hintQueue[3].state = this.hintQueue[3].nextState(1);
// J
this.hintQueue[4].x = 4;
this.hintQueue[4].y = 17;
this.hintQueue[4].state = this.hintQueue[4].nextState(-1);
// Z
this.hintQueue[5].x = 3;
this.hintQueue[5].y = 17;
this.hintQueue[5].state = this.hintQueue[5].nextState(2);
// T
this.hintQueue[6].x = 3;
this.hintQueue[6].y = 15;
// O
this.hintQueue[7].x = 5;
this.hintQueue[7].y = 15;
// I
this.hintQueue[8].x = 9;
this.hintQueue[8].y = 14;
//this.hintQueue[8].state = this.hintQueue[8].nextState(1);
// L
this.hintQueue[9].x = 2;
this.hintQueue[9].y = 13;
this.hintQueue[9].state = this.hintQueue[9].nextState(-1);
// J
this.hintQueue[10].x = -1;
this.hintQueue[10].y = 15;
this.hintQueue[10].state = this.hintQueue[10].nextState(1);
// T
this.hintQueue[11].x = 1;
this.hintQueue[11].y = 16;
this.hintQueue[11].state = this.hintQueue[11].nextState(2);
// O
this.hintQueue[12].x = 3;
this.hintQueue[12].y = 16;
this.hintQueue[12].state = this.hintQueue[12].nextState(1);
// T
this.hintQueue[13].x = 1;
this.hintQueue[13].y = 17;
this.hintQueue[13].state = this.hintQueue[13].nextState(-1);
}
this.isHintInit = 1;
return; return;
}, },
getNextHint(matrix) { getNextHint(matrix) {
this.initHint(matrix); this.initHint(matrix);
var mino = this.hintQueue[this.hintIdx]; var mino = this.hintQueue[this.hintIdx];
this.hintIdx++; this.hintIdx++;
if(this.hintIdx == 7) { if(this.hintIdx == this.hintQueue.length) {
this.hintIdx = 0; this.hintIdx = 0;
this.isHintInit = 0; this.isHintInit = 0;
} }