Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casual mode #213

Open
wants to merge 4 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion js/initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function initialize(a) {
speedModifier: 0.73,
speedUpKeyHeld: false,
creationSpeedModifier: 0.73,
comboTime: 310
comboTime: 310,
casualMode: true
};
} else {
settings = {
Expand Down
6 changes: 5 additions & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ function showHelp() {
}
}

$("#inst_main_body").html("<div id = 'instructions_head'>HOW TO PLAY</div><p>The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon.</p><p>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'Tap the left and right sides of the screen') + " to rotate the Hexagon." + (settings.platform != 'mobile' ? ' Press the down arrow to speed up the block falling': '') + " </p><p>Clear blocks and get points by making 3 or more blocks of the same color touch.</p><p>Time left before your combo streak disappears is indicated by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>on</span> the outer hexagon</p> <hr> <p id = 'afterhr'></p> By <a href='http://loganengstrom.com' target='_blank'>Logan Engstrom</a> & <a href='http://github.com/garrettdreyfus' target='_blank'>Garrett Finucane</a><br>Find Hextris on <a href = 'https://itunes.apple.com/us/app/id903769553?mt=8' target='_blank'>iOS</a> & <a href ='https://play.google.com/store/apps/details?id=com.hextris.hextris' target='_blank'>Android</a><br>More @ the <a href ='http://hextris.github.io/' target='_blank'>Hextris Website</a>");
$("#inst_main_body").html("<div id = 'instructions_head'>HOW TO PLAY</div><p>The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon.</p><p>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'Tap the left and right sides of the screen') + " to rotate the Hexagon." + (settings.platform != 'mobile' ? ' Press the down arrow to speed up the block falling': '') + " </p><p>Clear blocks and get points by making 3 or more blocks of the same color touch.</p><p>Time left before your combo streak disappears is indicated by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>on</span> the outer hexagon</p> <hr> <p id = 'afterhr'><label><input id='casualSwitch' type='checkbox'><span id='casualToggle'></span></label> Casual Mode</p> By <a href='http://loganengstrom.com' target='_blank'>Logan Engstrom</a> & <a href='http://github.com/garrettdreyfus' target='_blank'>Garrett Finucane</a><br>Find Hextris on <a href = 'https://itunes.apple.com/us/app/id903769553?mt=8' target='_blank'>iOS</a> & <a href ='https://play.google.com/store/apps/details?id=com.hextris.hextris' target='_blank'>Android</a><br>More @ the <a href ='http://hextris.github.io/' target='_blank'>Hextris Website</a>");
$("#casualToggle").on('touchstart mousedown', function() {
settings.casualMode = !document.getElementById("casualSwitch").checked
});

if (gameState == 1) {
pause();
}
Expand Down
11 changes: 9 additions & 2 deletions js/wavegen.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
function blockDestroyed() {
var maxDifficulty = 35;
if (settings.casualMode === undefined){
settings.casualMode = false
} else if (settings.casualMode){
maxDifficulty = 8;
}

if (waveone.nextGen > 1350) {
waveone.nextGen -= 30 * settings.creationSpeedModifier;
} else if (waveone.nextGen > 600) {
Expand All @@ -7,10 +14,10 @@ function blockDestroyed() {
waveone.nextGen = 600;
}

if (waveone.difficulty < 35) {
if (waveone.difficulty < maxDifficulty) {
waveone.difficulty += 0.085 * settings.speedModifier;
} else {
waveone.difficulty = 35;
waveone.difficulty = maxDifficulty;
}
}

Expand Down
15 changes: 15 additions & 0 deletions style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ button:focus {

}

#casualSwitch:checked + #casualToggle {
background-color: aqua;
box-shadow: 0 0 6px rgba(0, 204, 255, 1);
}

#casualSwitch{
visibility: hidden;
}

#casualToggle{
font-size: 8px;
padding: 0px 12px;
border-radius: 5px;
background-color: #ccc;
}

#pauseBtn {
display:none;
Expand Down