From ece7cfb9778e6b4a07d3bf22511b577d8f5cbc3c Mon Sep 17 00:00:00 2001 From: Garrett Finucane Date: Fri, 29 May 2015 20:23:17 -0400 Subject: [PATCH] half done porting end game --- index.html | 117 +++++++++++++++++++++++++++++-------- js_v9/initialization.js | 18 ------ js_v9/input.js | 10 ++++ js_v9/main.js | 4 -- js_v9/view.js | 38 +----------- style/style.css | 125 +++++++++++++++++++++++++++++++++++----- test_endgame.html | 11 +++- 7 files changed, 223 insertions(+), 100 deletions(-) diff --git a/index.html b/index.html index 75a7719..09e2d98 100644 --- a/index.html +++ b/index.html @@ -55,27 +55,24 @@ + + + -
- -
-
- iOS Android
- About/Contact -
@@ -85,17 +82,87 @@
-
-
- - - - - -
HIGH SCORE
Fork me on GitHub + + + +
+
+
GAME OVER
+
1843
+
HIGH SCORES
+
1. 1870
+
2. 1540
+
3. 1130
+
4. 960
+
+
+ +
+ + + + Share button + + + + + + + + SHARE MY SCORE! + + + + + +
+ +
+
+ diff --git a/js_v9/initialization.js b/js_v9/initialization.js index 0d49df1..3843e69 100644 --- a/js_v9/initialization.js +++ b/js_v9/initialization.js @@ -1,24 +1,6 @@ $(document).ready(function() { initialize(); - $('#bottombar').hide(); }); - -function showbottombar() { - var isOffline = 'onLine' in navigator && !navigator.onLine; - if (isOffline) { - setTimeout(showbottombar, 1000); - } else { - window.iframeHasLoaded = true; - if (gameState != 1) { - $('#bottombar').fadeIn(150, 'linear'); - } - } -} - -function hidebottombar() { - $('#bottombar').fadeOut(150, 'linear'); -} - function initialize(a) { window.rush = 1; window.lastTime = Date.now(); diff --git a/js_v9/input.js b/js_v9/input.js index a72d814..70720d2 100644 --- a/js_v9/input.js +++ b/js_v9/input.js @@ -120,12 +120,22 @@ function addKeyListeners() { init(1); canRestart = false; }); + $("#restart").on('touchstart', function() { + init(1); + canRestart = false; + }); + } else { $("#restartBtn").on('mousedown', function() { init(1); canRestart = false; }); + $("#restart").on('mousedown', function() { + init(1); + canRestart = false; + }); + } } function inside (point, vs) { diff --git a/js_v9/main.js b/js_v9/main.js index c8ba76f..a181ea0 100644 --- a/js_v9/main.js +++ b/js_v9/main.js @@ -63,13 +63,11 @@ function hideUIElements() { $('#restartBtn').hide(); $('#startBtn').hide(); $("#attributions").hide(); - $("#bottombar").hide(); } function init(b) { if(settings.ending_block && b == 1){return;} if (b) { - hidebottombar(); $("#pauseBtn").attr('src',"./images/btn_pause.svg"); @@ -197,7 +195,6 @@ function setStartScreen() { $('#restartBtn').hide(); $('#startBtn').show(); $('#attributions').show(); - showbottombar(); gameState = 0; requestAnimFrame(animLoop); @@ -244,7 +241,6 @@ function animLoop() { if ($('#restartBtn').is(':visible')) $('#restartBtn').fadeOut(150, "linear"); if ($('#openSideBar').is(':visible')) $('.openSideBar').fadeOut(150, "linear"); - showbottombar(); canRestart = 0; clearSaveState(); } diff --git a/js_v9/view.js b/js_v9/view.js index ed7bfca..df2ef23 100644 --- a/js_v9/view.js +++ b/js_v9/view.js @@ -103,7 +103,6 @@ function showText(text) { 'paused': "
Paused

Press p to resume
", 'pausedAndroid': "
Paused

Press to resume
", 'start': "
Press enter to start
", - 'gameover': "
Game Over: " + score + " pts

High Scores:
" }; if (text == 'paused') { @@ -114,41 +113,11 @@ function showText(text) { if (text == 'gameover') { //Clay('client.share.any', {text: 'Think you can beat my score of '+ score + ' in Super Cool Game?'}) - var allZ = 1; - var i; - - for (i = 0; i < 3; i++) { - if (highscores.length > i) { - messages['gameover'] += ""; - } - } - - var restartText; - if (settings.platform == 'mobile') { - restartText = 'Tap anywhere to restart!'; - } else { - restartText = 'Press enter (or click anywhere!) to restart!'; - } - - messages['gameover'] += "
" + (i + 1) + ". " + highscores[i] + " pts

" + restartText + "
"; - if (allZ) { - for (i = 0; i < highscores.length; i++) { - if (highscores[i] !== 0) { - allZ = 0; - } - } - } - } - messages['gameover'] += "" + $("#gameoverscreen").fadeIn(); + } $(".overlay").html(messages[text]); $(".overlay").fadeIn("1000", "swing"); - if (text == 'gameover') { - if (settings.platform == 'mobile') { - $('.tg').css('margin-top', '6px'); - $("#tapToRestart").css('margin-top','-19px') - } - } } function setMainMenu() { @@ -214,7 +183,6 @@ function gameOverDisplay() { var c = document.getElementById("canvas"); c.className = "blur"; showText('gameover'); - showbottombar(); } function pause(o) { @@ -237,14 +205,12 @@ function pause(o) { $("#pauseBtn").attr("src", "./images/btn_pause.svg"); $('.helpText').fadeOut(200, 'linear'); hideText(); - hidebottombar(); setTimeout(function() { gameState = prevGameState; }, 200) } else if (gameState != -2 && gameState !== 0 && gameState !== 2) { $('#restartBtn').fadeIn(150, "linear"); $('.helpText').fadeIn(200, 'linear'); - showbottombar(); if (message == 'paused') { showText(message); } diff --git a/style/style.css b/style/style.css index 633cc78..758d905 100644 --- a/style/style.css +++ b/style/style.css @@ -359,15 +359,19 @@ body { height:100%; width:100%; background-color:#ecf0f1; - z-index:3; + z-index:0; } - #title { z-index:99; margin-top:20px; color:#2c3e50; } +#gameoverscreen { + display:none; + +} + .unselectable { -webkit-touch-callout: none; -webkit-user-select: none; @@ -376,21 +380,114 @@ body { -ms-user-select: none; user-select: none; } - -#bottombar { - padding:0; - position:fixed; - width:1000px; - text-align:center; - left:50%; - margin-left:-500px; - bottom:10px; - z-index:98; -} - #afterhr { margin: 0; padding: 0; margin-bottom: -10px; padding-bottom: -10px; } + body { + overflow: hidden; + } + + @font-face { + font-family: Exo; + font-weight: light; + src:url("./style/fonts/Exo2-ExtraLight.otf") format("opentype"); + } + + @font-face { + font-family: Exo; + src:url("./style/fonts/Exo2-Regular.otf") format("opentype"); + } + + @font-face { + font-family: Exo; + font-weight: bold; + src:url("./style/fonts/Exo2-SemiBold.otf") format("opentype"); + } + + #container { + color: #232323; + position: absolute; + left:50%; + top:50%; + text-align: center; + transform: translate(-50%, -50%); + font-family: Exo; + -webkit-transform: translate(-50%, -50%); + -moz-transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + } + + .GOTitle { + font-weight: bold; + font-size: 24.2000px; + } + + #gameOverBox { + + } + + .scoreNum { + font-weight: normal ! important; + } + + #cScore { + font-size: 60.5000px; + font-weight:light; + margin-bottom: 5px; + margin-top: -10px; + } + + #highScoresTitle { + margin-bottom: 2px; + } + + .score { + font-weight: light; + line-height: 18px; + } + + #restart { + bottom:0; + position: absolute; + left:calc(50% - 124px); + transform: translate(-50%, 0%); + -webkit-transform: translate(-50%, 0%); + -moz-transform: translate(-50%, 0%); + -ms-transform: translate(-50%, 0%); + margin-bottom: 10px; + } + + #socialShare { + bottom: 0; + margin-bottom: 10px; + position: absolute; + left:calc(50% + 30px); + transform: translate(-50%, 0%); + -webkit-transform: translate(-50%, 0%); + -moz-transform: translate(-50%, 0%); + -ms-transform: translate(-50%, 0%); + } + + #bottomContainer { + position: absolute; + width:100%; + bottom: 0; + } + + #buttonCont { + position: absolute; + /*width:100%;*/ + left: 50%; + width: 310px; + margin-left:-8px; + bottom:78px; + transform: translate(-50%, 0%); + -webkit-transform: translate(-50%, 0%); + -moz-transform: translate(-50%, 0%); + -ms-transform: translate(-50%, 0%); + /*width:300px;*/ + } + diff --git a/test_endgame.html b/test_endgame.html index dafaf79..4787abe 100644 --- a/test_endgame.html +++ b/test_endgame.html @@ -110,6 +110,7 @@ +
GAME OVER
1843
@@ -123,7 +124,7 @@
- + Share button @@ -131,7 +132,7 @@ - + SHARE MY SCORE! @@ -219,5 +220,9 @@ })() + +
- \ No newline at end of file +