Skip to content

Commit

Permalink
Merge pull request #15 from hobnob/features/htmlAmends
Browse files Browse the repository at this point in the history
HTML amends
  • Loading branch information
hobnob committed Nov 28, 2012
2 parents 522bb2e + 6c7be00 commit 2ad7a3d
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 18 deletions.
47 changes: 37 additions & 10 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
body
{
background-color:#ECECEC;
}

#preload, #gameWindow
{
margin:auto;
}

#gameWindow
{
padding:19px 29px;
width:800px;
height:600px;
background-image:url('../img/game-window.png');
background-repeat:no-repeat;
display:none;
}

canvas
{
-moz-box-shadow: 0 0 10px #000000;
-webkit-box-shadow: 0 0 10px #000000;
box-shadow: 0 0 10px #000000;
}

#preload
{
padding-top:250px;
Expand All @@ -14,7 +41,7 @@

#game_tooltip
{
position:absolute;
position:relative;
width:800px;
background: linear-gradient(#ECECEC, #CACACA);
border-bottom: 1px solid #9A9A9A;
Expand All @@ -25,18 +52,16 @@
padding-bottom:10px;
font-weight: bold;
text-align: center;
top:8px;
left:8px;
top:-605px;
display:none;
}

#game_scorecard_bg
{
position:absolute;
position:relative;
width:800px;
height:600px;
top:8px;
left:8px;
top:-624px;
background-color: rgba(0,0,0,0.4);
display:none;
}
Expand Down Expand Up @@ -113,29 +138,31 @@

#game_scorecard .nextLevel
{
background-image:url(../img/next-off.png);
background-image:url(../img/next-button.png);
width:180px;
height:92px;
top:-313px;
margin-left:277px;
background-position: 0px 0px;
}

#game_scorecard .nextLevel:hover
{
background-image:url(../img/next-on.png);
background-position: -190px 0px;
}

#game_scorecard .mainMenu
{
background-image:url(../img/menu-off.png);
background-image:url(../img/menu-button.png);
width:180px;
height:92px;
margin-left:28px;
background-position: 0px 0px;
}

#game_scorecard .mainMenu:hover
{
background-image:url(../img/menu-on.png);
background-position: -190px 0px;
}

#game_scorecard .resetLevel
Expand Down
Binary file added img/game-window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/menu-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/menu-off.png
Binary file not shown.
Binary file removed img/menu-on.png
Binary file not shown.
Binary file added img/next-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/next-off.png
Binary file not shown.
Binary file removed img/next-on.png
Binary file not shown.
3 changes: 3 additions & 0 deletions index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
<img src="img/loading.gif" />
<img src="img/loading-text.png" />
</div>
<div id="gameWindow">
<canvas id="gjs-canvas"></canvas>
</div>
</body>
</html>
12 changes: 9 additions & 3 deletions js/lib/levels/level_1.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@
{"type":"door", "x":700,"y":218}
]},
{
"type":"tooltip","x":300,"y":641,"width":100,"height":100,
"text":"Press <span class='button e'>e</span> or <span class='button enter'>enter</span> to activate switches<br>At least one clone must remain at a switch to keep it active"},
"type":"tooltip","x":150,"y":641,"width":50,"height":50,
"text":"Press the <span class='button left'>left</span> arrow or <span class='button a'>a</span> to move left<br>Press the <span class='button right'>right</span> arrow or <span class='button d'>d</span> to move right"
},
{
"type":"tooltip","x":350,"y":641,"width":50,"height":50,
"text":"Press <span class='button e'>e</span> or <span class='button enter'>enter</span> to activate switches<br>At least one clone must remain at a switch to keep it active"
},
{
"type":"tooltip","x":650,"y":641,"width":50,"height":50,
"text":"Press <span class='button c'>c</span> to create a clone<br/>Press <span class='button tab'>tab</span> to switch between them"},
"text":"Press <span class='button c'>c</span> to create a clone<br/>Press <span class='button tab'>tab</span> to switch between them"
},
{"type":"goal","x":890,"y":540}
]
2 changes: 1 addition & 1 deletion js/lib/scorecard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function scorecard()

if ( !($('#game_scorecard').length) )
{
$('body').append('<div id="game_scorecard_bg"></div>');
$('#gameWindow').append('<div id="game_scorecard_bg"></div>');
$('#game_scorecard_bg').append('<div id="game_scorecard"></div>');
$('#game_scorecard').append('<h1>Results</h1>');
$('#game_scorecard').append('<p>Number of Clones<span class="clones">0</span></p>');
Expand Down
20 changes: 17 additions & 3 deletions js/lib/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function tooltip()

if ( !($('#game_tooltip').length) )
{
$('body').append('<div id="game_tooltip"></div>');
$('#gameWindow').append('<div id="game_tooltip"></div>');
}

var _text = '';
Expand Down Expand Up @@ -40,8 +40,22 @@ function tooltip()
tooltip.timer = setTimeout(this.hide, 5000)
}

this.hide = function(){
$('#game_tooltip').fadeOut();
this.hide = function(animate){
if ( typeof(animate) == 'undefined' )
{
animate = true;
}

if ( animate )
{
$('#game_tooltip').fadeOut();
}
else
{
$('#game_tooltip').hide();
}


tooltip.timer = null;
}

Expand Down
9 changes: 9 additions & 0 deletions js/lib/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ function world()

if ( _levelComplete )
{
for( var i = 0; i < _objects.sprites().length; i++ )
{
var obj = _objects.sprites()[i];
if ( obj instanceof tooltip )
{
obj.hide(false);
}
}

_scorecard.setTimeTaken(_gameTime / 1000);
_scorecard.setClonesUsed(_p.getNumClones());
_scorecard.show();
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ gamejs.ready(function() {
$('#game_scorecard .resetLevel').click();
event.preventDefault();
break;

}
}
});

//Remove the loading bar
$('#preload').remove();
$('#gameWindow').show();

//Set up the tick function, run at 60fps
gamejs.time.fpsCallback(tick, self, 60);
Expand Down

0 comments on commit 2ad7a3d

Please sign in to comment.