This commit is contained in:
Garrett Finucane 2014-09-04 18:45:23 -04:00
commit 0a7ce62164
15 changed files with 36 additions and 30 deletions

View file

@ -37,20 +37,20 @@
<script type = 'text/javascript' src="vendor/jsonfn.min.js"></script> <script type = 'text/javascript' src="vendor/jsonfn.min.js"></script>
<script type = 'text/javascript' src="vendor/keypress.min.js"></script> <script type = 'text/javascript' src="vendor/keypress.min.js"></script>
<script type = 'text/javascript' src="vendor/jquery.js"></script> <script type = 'text/javascript' src="vendor/jquery.js"></script>
<script type = 'text/javascript' src="js/save-state.js"></script> <script type = 'text/javascript' src="js_v8/save-state.js"></script>
<script type = 'text/javascript' src="js/view.js"></script> <script type = 'text/javascript' src="js_v8/view.js"></script>
<script type = 'text/javascript' src="js/wavegen.js"></script> <script type = 'text/javascript' src="js_v8/wavegen.js"></script>
<script type = 'text/javascript' src="js/math.js"></script> <script type = 'text/javascript' src="js_v8/math.js"></script>
<script type = 'text/javascript' src="js/Block.js"></script> <script type = 'text/javascript' src="js_v8/Block.js"></script>
<script type = 'text/javascript' src="js/Hex.js"></script> <script type = 'text/javascript' src="js_v8/Hex.js"></script>
<script type = 'text/javascript' src="js/Text.js"></script> <script type = 'text/javascript' src="js_v8/Text.js"></script>
<script type = 'text/javascript' src="js/comboTimer.js"></script> <script type = 'text/javascript' src="js_v8/comboTimer.js"></script>
<script type = 'text/javascript' src="js/checking.js"></script> <script type = 'text/javascript' src="js_v8/checking.js"></script>
<script type = 'text/javascript' src='js/update.js'></script> <script type = 'text/javascript' src='js_v8/update.js'></script>
<script type = 'text/javascript' src='js/render.js'></script> <script type = 'text/javascript' src='js_v8/render.js'></script>
<script type = 'text/javascript' src="js/input.js"></script> <script type = 'text/javascript' src="js_v8/input.js"></script>
<script type = 'text/javascript' src="js/main.js"></script> <script type = 'text/javascript' src="js_v8/main.js"></script>
<script type = 'text/javascript' src="js/initialization.js"></script> <script type = 'text/javascript' src="js_v8/initialization.js"></script>
<script type = 'text/javascript' charset = 'utf-8' src = 'cordova.js'></script> <script type = 'text/javascript' charset = 'utf-8' src = 'cordova.js'></script>
</head> </head>
<body> <body>
@ -71,7 +71,7 @@
<div id="overlay" class="faded"></div> <div id="overlay" class="faded"></div>
<div id="attributions">Started by <a href="http://github.com/teamsnowman" target="_blank">@teamsnowman</a> at <a href= 'http://www.hackexeter.com/' target="_blank">HackExeter</a><br> <div id="attributions">Started by <a href="http://github.com/teamsnowman" target="_blank">@teamsnowman</a> at <a href= 'http://www.hackexeter.com/' target="_blank">HackExeter</a><br>
Finished by <a href="http://github.com/meadowstream" target="_blank">Logan Engstrom</a> & <a href='http://github.com/garrettdreyfus' target="_blank">Garrett Finucane</a> on <a href = 'http://github.com/hextris/hextris' target="_blank">GitHub</a><br> Finished by <a href="http://github.com/meadowstream" target="_blank">Logan Engstrom</a> & <a href='http://github.com/garrettdreyfus' target="_blank">Garrett Finucane</a> on <a href = 'http://github.com/hextris/hextris' target="_blank">GitHub</a><br>
<a href = 'https://itunes.apple.com/us/app/id903769553?mt=8'>iOS</a> & <a href ='https://play.google.com/store/apps/details?id=com.hextris.hextris'>Android</a> apps + <a href ='http://hextris.github.io/presskit/info.html'>press kit</a> @ <a href='http://hextris.github.io/'>http://hextris.github.io/</a> <a href = 'https://itunes.apple.com/us/app/id903769553?mt=8'><b>iOS</b></a> <b>&</b> <a href ='https://play.google.com/store/apps/details?id=com.hextris.hextris'><b>Android</b></a> apps + <a href ='http://hextris.github.io/presskit/info.html'>press kit</a> @ <a href='http://hextris.github.io/'>http://hextris.github.io/</a>
</div> </div>
<div id='startBtn' style='position:absolute;left:40%;top:38%;height:25%;width:25%;z-index:99999999;cursor:pointer;'></div> <div id='startBtn' style='position:absolute;left:40%;top:38%;height:25%;width:25%;z-index:99999999;cursor:pointer;'></div>
<div id="helpScreen" class = 'unselectable'> <div id="helpScreen" class = 'unselectable'>

View file

@ -77,9 +77,10 @@ function initialize(a) {
if (/Mobile|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { if (/Mobile|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
settings = { settings = {
os: "other",
platform: "mobile", platform: "mobile",
startDist: 227, startDist: 227,
creationDt: 40, creationDt: 60,
baseScale: 1.4, baseScale: 1.4,
scale: 1, scale: 1,
prevScale: 1, prevScale: 1,
@ -94,6 +95,7 @@ function initialize(a) {
}; };
} else { } else {
settings = { settings = {
os: "other",
platform: "nonmobile", platform: "nonmobile",
baseScale: 1, baseScale: 1,
startDist: 340, startDist: 340,
@ -112,6 +114,9 @@ function initialize(a) {
$("#inst_main_body").html("The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon<br><br>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'tap the left and right sides of the screen') + " to rotate the Hexagon<br><br>Clear blocks and get points by making 3 or more blocks of the same color touch<br><br>Time left before your combo streak disappears is indicated shown by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>in</span> the outer hexagon<br><br> " + (settings.platform == 'mobile' ? 'Toggle speeding up the game by tapping the inner hexagon' : "Speed up the game 2x by holding the down arrow")); $("#inst_main_body").html("The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon<br><br>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'tap the left and right sides of the screen') + " to rotate the Hexagon<br><br>Clear blocks and get points by making 3 or more blocks of the same color touch<br><br>Time left before your combo streak disappears is indicated shown by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>in</span> the outer hexagon<br><br> " + (settings.platform == 'mobile' ? 'Toggle speeding up the game by tapping the inner hexagon' : "Speed up the game 2x by holding the down arrow"));
} }
if(/Android/i.test(navigator.userAgent)) {
settings.os = "android";
}
window.canvas = document.getElementById('canvas'); window.canvas = document.getElementById('canvas');
window.ctx = canvas.getContext('2d'); window.ctx = canvas.getContext('2d');

View file

@ -98,15 +98,14 @@ function toggleClass(element, active) {
function showText(text) { function showText(text) {
var messages = { var messages = {
'paused': "<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectable centeredSubHeader'>Press p to resume</div><div style='height:100px;line-height:100px;cursor:pointer;'></div>", 'paused': "<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectable centeredSubHeader'>Press p to resume</div><div style='height:100px;line-height:100px;cursor:pointer;'></div>",
'pausedMobile': "<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectable centeredSubHeader'>Press <i class='fa fa-play'></i> to resume</div><div style='height:100px;line-height:100px;cursor:pointer;'></div>", 'pausedAndroid': "<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectable centeredSubHeader'>Press <i class='fa fa-play'></i> to resume</div><div style='height:100px;line-height:100px;cursor:pointer;'></div><div class='unselectable centeredSubHeader' style='margin-top:-50px;'><a href = 'market://details?id=com.hextris.hextrisadfree' target='_blank'>Don't like ads? Want to support the developer? Tap for the ad-free version.</a></div>",
'start': "<div class='centeredHeader unselectable' style='line-height:80px;'>Press enter to start</div>", 'start': "<div class='centeredHeader unselectable' style='line-height:80px;'>Press enter to start</div>",
'gameover': "<div class='centeredHeader unselectable'> Game Over: " + score + " pts</div><br><div style='font-size:24px;' class='centeredHeader unselectable'> High Scores:</div><table class='tg' style='margin:0px auto'> " 'gameover': "<div class='centeredHeader unselectable'> Game Over: " + score + " pts</div><br><div style='font-size:24px;' class='centeredHeader unselectable'> High Scores:</div><table class='tg' style='margin:0px auto'> "
}; };
if (text == 'paused') { if (text == 'paused') {
if (settings.platform == 'mobile') { if (settings.os == 'android') {
text = 'pausedMobile'; text = 'pausedAndroid';
} }
} }
@ -199,7 +198,6 @@ function pause(o) {
setTimeout(function() { setTimeout(function() {
gameState = prevGameState; gameState = prevGameState;
}, 200) }, 200)
} else if (gameState != -2 && gameState !== 0 && gameState !== 2) { } else if (gameState != -2 && gameState !== 0 && gameState !== 2) {
$('#restartBtn').fadeIn(150, "linear"); $('#restartBtn').fadeIn(150, "linear");
$('.helpText').fadeIn(200, 'linear'); $('.helpText').fadeIn(200, 'linear');

View file

@ -1,14 +1,14 @@
function blockDestroyed() { function blockDestroyed() {
if (waveone.nextGen > 1350) { if (waveone.nextGen > 1350) {
waveone.nextGen -= 26 * settings.creationSpeedModifier; waveone.nextGen -= 30 * settings.creationSpeedModifier;
} else if (waveone.nextGen > 600) { } else if (waveone.nextGen > 600) {
waveone.nextGen -= 13 * settings.creationSpeedModifier; waveone.nextGen -= 8 * settings.creationSpeedModifier;
} else { } else {
waveone.nextGen = 600; waveone.nextGen = 600;
} }
if (waveone.difficulty < 35) { if (waveone.difficulty < 35) {
waveone.difficulty += 0.145 * settings.speedModifier; waveone.difficulty += 0.085 * settings.speedModifier;
} else { } else {
waveone.difficulty = 35; waveone.difficulty = 35;
} }
@ -17,7 +17,7 @@ function blockDestroyed() {
function waveGen(hex) { function waveGen(hex) {
this.lastGen = 0; this.lastGen = 0;
this.last = 0; this.last = 0;
this.nextGen = 2200; this.nextGen = 2700;
this.start = 0; this.start = 0;
this.colors = colors; this.colors = colors;
this.ct = 0; this.ct = 0;
@ -26,11 +26,11 @@ function waveGen(hex) {
this.dt = 0; this.dt = 0;
this.update = function() { this.update = function() {
this.currentFunction(); this.currentFunction();
this.dt = (16.6667) * MainHex.ct; this.dt = (settings.platform == 'mobile' ? 14 : 16.6667) * MainHex.ct;
this.computeDifficulty(); this.computeDifficulty();
if ((this.dt - this.lastGen) * settings.creationSpeedModifier > this.nextGen) { if ((this.dt - this.lastGen) * settings.creationSpeedModifier > this.nextGen) {
if (this.nextGen > 600) { if (this.nextGen > 600) {
this.nextGen -= 14 * ((this.nextGen / 1300)) * settings.creationSpeedModifier; this.nextGen -= 11 * ((this.nextGen / 1300)) * settings.creationSpeedModifier;
} }
} }
}; };
@ -66,13 +66,16 @@ function waveGen(hex) {
this.computeDifficulty = function() { this.computeDifficulty = function() {
if (this.difficulty < 35) { if (this.difficulty < 35) {
var increment;
if (this.difficulty < 8) { if (this.difficulty < 8) {
this.difficulty += (this.dt - this.last) / (2066667) * settings.speedModifier; increment = (this.dt - this.last) / (5166667) * settings.speedModifier;
} else if (this.difficulty < 15) { } else if (this.difficulty < 15) {
this.difficulty += (this.dt - this.last) / (43333333) * settings.speedModifier; increment = (this.dt - this.last) / (72333333) * settings.speedModifier;
} else { } else {
this.difficulty += (this.dt - this.last) / (90000000) * settings.speedModifier; increment = (this.dt - this.last) / (90000000) * settings.speedModifier;
} }
this.difficulty += increment * (1/2);
} }
}; };