diff --git a/js/Hex.js b/js/Hex.js index 64f917b0c..e9710643c 100644 --- a/js/Hex.js +++ b/js/Hex.js @@ -18,7 +18,17 @@ function Hex(sideLength) { this.ct = 0; this.lastCombo = this.ct - settings.comboTime; this.lastColorScored = "#000"; - this.comboTime = 1; + this.adrenalineMode = -1000; + this.adrenalineDuration = 800; + this.combosToAdrenaline = 9; + this.adrenalineColor = 1; + this.adrenalineMultiplier = 2; + + this.adrenalineOn = function(){ + return this.ct - this.adrenalineMode < this.adrenalineDuration; + } + + this.texts = []; this.lastRotate = Date.now(); for (var i = 0; i < this.sides; i++) { diff --git a/js/checking.js b/js/checking.js index 800013709..8ea8284a5 100644 --- a/js/checking.js +++ b/js/checking.js @@ -65,12 +65,17 @@ function consolidateBlocks(hex,side,index){ // add scores var now = MainHex.ct; - if(now - hex.lastCombo < settings.comboTime ){ + if(now - hex.lastCombo < settings.comboTime && !MainHex.adrenalineOn()){ settings.comboTime = (1/settings.creationSpeedModifier) * (waveone.nextGen/16.666667) * 3; hex.comboMultiplier += 1; hex.lastCombo = now; var coords = findCenterOfBlocks(deletedBlocks); hex.texts.push(new Text(coords['x'],coords['y'],"x "+hex.comboMultiplier.toString(),"bold Q","#fff",fadeUpAndOut)); + if(hex.comboMultiplier >= MainHex.combosToAdrenaline){ + hex.adrenalineMode = now; + hex.comboMultiplier = 1; + hex.adrenalineColor = randInt(0, colors.length); + } } else{ settings.comboTime = 240; diff --git a/js/comboTimer.js b/js/comboTimer.js index b514906bc..2fca89b9e 100644 --- a/js/comboTimer.js +++ b/js/comboTimer.js @@ -4,10 +4,10 @@ function drawTimer() { var rightVertexes = []; if(MainHex.ct - MainHex.lastCombo < settings.comboTime){ for(var i=0;i<6;i++){ - var done = (MainHex.ct -MainHex.lastCombo); + var done = (MainHex.ct - MainHex.lastCombo); if(done<(settings.comboTime)*(5-i)*(1/6)){ leftVertexes.push(calcSide(i,i+1,1,1)); - rightVertexes.push(calcSide(12-i,11-i,1,1)); + rightVertexes.push(calcSide(12-i,11-i,1,1)); } else{ leftVertexes.push(calcSide(i,i+1,1-((done*6)/settings.comboTime)%(1),1)); diff --git a/js/main.js b/js/main.js index afc8515d6..7693cd780 100644 --- a/js/main.js +++ b/js/main.js @@ -183,7 +183,9 @@ function init(b) { } function addNewBlock(blocklane, color, iter, distFromHex, settled) { //last two are optional parameters - iter *= settings.speedModifier; + if(!MainHex.adrenalineOn()) + iter *= settings.speedModifier; + else iter *= settings.speedModifier*MainHex.adrenalineMultiplier; if (!history[MainHex.ct]) { history[MainHex.ct] = {}; } diff --git a/js/render.js b/js/render.js index 4c3a550fd..cdad8044d 100644 --- a/js/render.js +++ b/js/render.js @@ -1,5 +1,6 @@ function render() { var grey = '#bdc3c7'; + var red = '#ff93a5'; if (gameState === 0) { grey = "rgb(220, 223, 225)"; } @@ -11,7 +12,10 @@ function render() { op += 0.01; } ctx.globalAlpha = op; - drawPolygon(trueCanvas.width / 2 , trueCanvas.height / 2 , 6, (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth, 30, grey, false,6); + if(MainHex.adrenalineOn()) + drawPolygon(trueCanvas.width / 2 , trueCanvas.height / 2 , 6, (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth, 30, red, false,6); + else + drawPolygon(trueCanvas.width / 2 , trueCanvas.height / 2 , 6, (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth, 30, grey, false,6); drawTimer(); ctx.globalAlpha = 1; } diff --git a/js/wavegen.js b/js/wavegen.js index a4e85ff77..4d7891373 100644 --- a/js/wavegen.js +++ b/js/wavegen.js @@ -24,23 +24,31 @@ function waveGen(hex) { this.hex = hex; this.difficulty = 1; this.dt = 0; + this.adrenalineMultiplier = 1; this.update = function() { this.currentFunction(); this.dt = (settings.platform == 'mobile' ? 14 : 16.6667) * MainHex.ct; this.computeDifficulty(); + if(!MainHex.adrenalineOn()){ + this.adrenalineMultiplier = 1; + }else this.adrenalineMultiplier = MainHex.adrenalineMultiplier; if ((this.dt - this.lastGen) * settings.creationSpeedModifier > this.nextGen) { if (this.nextGen > 600) { this.nextGen -= 11 * ((this.nextGen / 1300)) * settings.creationSpeedModifier; - } - } + }} }; this.randomGeneration = function() { - if (this.dt - this.lastGen > this.nextGen) { + if (this.dt - this.lastGen > this.nextGen / this.adrenalineMultiplier) { this.ct++; this.lastGen = this.dt; var fv = randInt(0, MainHex.sides); - addNewBlock(fv, colors[randInt(0, colors.length)], 1.6 + (this.difficulty / 15) * 3); + + if(!MainHex.adrenalineOn()) + addNewBlock(fv, colors[randInt(0, colors.length)], 1.6 + (this.difficulty / 15) * 3); + else + addNewBlock(fv, colors[MainHex.adrenalineColor], 1.6 + (this.difficulty / 15) * 3); + var lim = 5; if (this.ct > lim) { var nextPattern = randInt(0, 3 + 21); @@ -80,7 +88,7 @@ function waveGen(hex) { }; this.circleGeneration = function() { - if (this.dt - this.lastGen > this.nextGen + 500) { + if (this.dt - this.lastGen > (this.nextGen + 500) / this.adrenalineMultiplier) { var numColors = randInt(1, 4); if (numColors == 3) { numColors = randInt(1, 4); @@ -99,7 +107,10 @@ function waveGen(hex) { } for (var i = 0; i < MainHex.sides; i++) { - addNewBlock(i, colorList[i % numColors], 1.5 + (this.difficulty / 15) * 3); + if(!MainHex.adrenalineOn()) + addNewBlock(i, colorList[i % numColors], 1.5 + (this.difficulty / 15) * 3); + else + addNewBlock(i, colors[MainHex.adrenalineColor], 1.5 + (this.difficulty / 15) * 3); } this.ct += 15; @@ -109,7 +120,7 @@ function waveGen(hex) { }; this.halfCircleGeneration = function() { - if (this.dt - this.lastGen > (this.nextGen + 500) / 2) { + if (this.dt - this.lastGen > ((this.nextGen + 500) / 2 ) / this.adrenalineMultiplier) { var numColors = randInt(1, 3); var c = colors[randInt(0, colors.length)]; var colorList = [c, c, c]; @@ -119,7 +130,10 @@ function waveGen(hex) { var d = randInt(0, 6); for (var i = 0; i < 3; i++) { - addNewBlock((d + i) % 6, colorList[i], 1.5 + (this.difficulty / 15) * 3); + if(!MainHex.adrenalineOn()) + addNewBlock((d + i) % 6, colorList[i], 1.5 + (this.difficulty / 15) * 3); + else + addNewBlock((d + i) % 6, colors[MainHex.adrenalineColor], 1.5 + (this.difficulty / 15) * 3); } this.ct += 8; @@ -129,11 +143,16 @@ function waveGen(hex) { }; this.crosswiseGeneration = function() { - if (this.dt - this.lastGen > this.nextGen) { + if (this.dt - this.lastGen > this.nextGen / this.adrenalineMultiplier) { var ri = randInt(0, colors.length); var i = randInt(0, colors.length); - addNewBlock(i, colors[ri], 0.6 + (this.difficulty / 15) * 3); - addNewBlock((i + 3) % MainHex.sides, colors[ri], 0.6 + (this.difficulty / 15) * 3); + if(!MainHex.adrenalineOn()){ + addNewBlock(i, colors[ri], 0.6 + (this.difficulty / 15) * 3); + addNewBlock((i + 3) % MainHex.sides, colors[ri], 0.6 + (this.difficulty / 15) * 3); + }else{ + addNewBlock(i, colors[MainHex.adrenalineColor], 0.6 + (this.difficulty / 15) * 3); + addNewBlock((i + 3) % MainHex.sides, colors[MainHex.adrenalineColor], 0.6 + (this.difficulty / 15) * 3); + } this.ct += 1.5; this.lastGen = this.dt; this.shouldChangePattern(); @@ -142,11 +161,19 @@ function waveGen(hex) { this.spiralGeneration = function() { var dir = randInt(0, 2); - if (this.dt - this.lastGen > this.nextGen * (2 / 3)) { - if (dir) { - addNewBlock(5 - (this.ct % MainHex.sides), colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2)); - } else { - addNewBlock(this.ct % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2)); + if (this.dt - this.lastGen > (this.nextGen * (2 / 3))/ this.adrenalineMultiplier) { + if(!MainHex.adrenalineOn()){ + if (dir) { + addNewBlock(5 - (this.ct % MainHex.sides), colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2)); + } else { + addNewBlock(this.ct % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * (3 / 2)); + } + }else{ + if (dir) { + addNewBlock(5 - (this.ct % MainHex.sides), colors[MainHex.adrenalineColor], 1.5 + (this.difficulty / 15) * (3 / 2)); + } else { + addNewBlock(this.ct % MainHex.sides, colors[MainHex.adrenalineColor], 1.5 + (this.difficulty / 15) * (3 / 2)); + } } this.ct += 1; this.lastGen = this.dt; @@ -155,10 +182,15 @@ function waveGen(hex) { }; this.doubleGeneration = function() { - if (this.dt - this.lastGen > this.nextGen) { + if (this.dt - this.lastGen > this.nextGen / this.adrenalineMultiplier) { var i = randInt(0, colors.length); - addNewBlock(i, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * 3); - addNewBlock((i + 1) % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * 3); + if(!MainHex.adrenalineOn()){ + addNewBlock(i, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * 3); + addNewBlock((i + 1) % MainHex.sides, colors[randInt(0, colors.length)], 1.5 + (this.difficulty / 15) * 3); + }else{ + addNewBlock(i, colors[MainHex.adrenalineColor], 1.5 + (this.difficulty / 15) * 3); + addNewBlock((i + 1) % MainHex.sides, colors[MainHex.adrenalineColor], 1.5 + (this.difficulty / 15) * 3); + } this.ct += 2; this.lastGen = this.dt; this.shouldChangePattern();