Skip to content

Commit

Permalink
Merge pull request #14 from hobnob/features/shortcuts
Browse files Browse the repository at this point in the history
Adds shortcuts for the scoreboard
  • Loading branch information
hobnob committed Nov 28, 2012
2 parents c3b2586 + 28e3561 commit 522bb2e
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 2 deletions.
Binary file added img/apple-touch-icon-114x114.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/apple-touch-icon-72x72.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/favicon.ico
Binary file not shown.
Binary file added img/touch-icon-iphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link media="screen" href="css/main.css" rel="stylesheet" type="text/css" />

<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<link rel="apple-touch-icon" sizes="114x114" href="img/touch-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="72x72" href="img/touch-icon-72x72.png" />
<link rel="apple-touch-icon" href="img/touch-icon-iphone.png" />

<script type="text/javascript" src="js/jquery-1.8.2.js"></script>
<script type="text/javascript" src="js/gamejs/yabble.js"></script>
<script type="text/javascript" src="js/gamejs/gamejs.min.js"></script>
Expand All @@ -14,7 +20,7 @@
require.run('main');
});
</script>
<title>Clone Game</title>
<title>Alge's Escapade</title>
</head>
<body>
<div id="preload">
Expand Down
4 changes: 3 additions & 1 deletion js/lib/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ function world()
isCurrentPlayer = true;
}

colliders[i].b.handleCollision( colliders[i].a, isCurrentPlayer );
colliders[i].b.handleCollision(
colliders[i].a, isCurrentPlayer
);
}
}

Expand Down
35 changes: 35 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,41 @@ gamejs.ready(function() {
mainWindow.draw( mainSurface );
};

//Set up listeners for the body when a scorecard is present
$('body').keydown(function(event){
//Only check key presses if the scorcard is shown
if ( $('#game_scorecard').is(":visible") )
{
switch ( event.keyCode )
{
//Enter, Space, up, w, and e will all move
//to the next level
case 13:
case 32:
case 38:
case 87:
case 69:
$('#game_scorecard .nextLevel').click();
event.preventDefault();
break;
//Escape will quit to the menu
case 27:
$('#game_scorecard .mainMenu').click();
event.preventDefault();
break;
//r will reset the level
case 82:
$('#game_scorecard .resetLevel').click();
event.preventDefault();
break;

}
}
});

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

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

0 comments on commit 522bb2e

Please sign in to comment.