Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added tv, scaled map, sorted scores

  • Loading branch information...
commit d5f65c7123e07b03848b00ef4276a486805603b0 1 parent 9aaa2bd
@MrJaba MrJaba authored
View
41 public/css/bomberman.css
@@ -0,0 +1,41 @@
+body {
+ background:url('/images/retro-tv.jpg') no-repeat 25% 5%;
+}
+
+#map {
+ display:none;
+}
+
+#canvas{
+ position:relative;
+ float:left;
+ top:10%;
+ left:19%;
+}
+
+#score-holder{
+ float:right;
+}
+
+#score-holder h3{
+ border-bottom:1px solid black
+}
+
+#score-holder ul#scores{
+ list-style-type:none;
+ margin:0;
+ padding:0;
+}
+
+#score-holder ul#scores li span.score{
+ font-size:2em;
+}
+
+#score-holder ul#scores li span.uuid{
+
+}
+
+#score-holder ul#scores li.me{
+ background-color:red;
+}
+
View
BIN  public/images/retro-tv.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
12 public/index.html
@@ -10,24 +10,24 @@
<script src="javascripts/bomb.js" type="text/javascript"></script>
<script src="javascripts/sprite.js" type="text/javascript"></script>
<script src="javascripts/movement.js" type="text/javascript"></script>
-
+ <link rel="Stylesheet" href="/css/bomberman.css" type="text/css" media="screen"/>
</head>
<body>
- <table id="map" style="display:none">
+ <table id="map">
<tr><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td></tr>
<tr><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td></tr>
- <tr><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td></tr>
+ <tr><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td></tr>
<tr><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td></tr>
- <tr><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td></tr>
+ <tr><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td></tr>
<tr><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td><td walk='false'>WallBlockTall</td><td>StoneBlock</td></tr>
<tr><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td><td>StoneBlock</td></tr>
</table>
<canvas id="canvas"></canvas>
- <div id="score-holder" style="width:200px;float:right;">
- <h3 style="border-bottom:1px solid black">Scores</h3>
+ <div id="score-holder">
+ <h3>Score</h3>
<ul id="scores">
</ul>
</div>
View
19 public/javascripts/game.js
@@ -31,8 +31,11 @@ MrJaba.Bomberman = function(){
}
function draw(){
+ canvas().save();
+ canvas().scale(0.6,0.6);
drawBaseTiles();
drawHighWallsAndSprites();
+ canvas().restore();
}
function drawBaseTiles(){
@@ -102,6 +105,17 @@ MrJaba.Bomberman = function(){
MrJaba.Bomberman.GameClient.trigger('send_reset_state', "restart");
}
+ function sortScores(){
+ var mylist = $('#scores');
+ var listitems = mylist.children('li').get();
+ listitems.sort(function(a, b) {
+ var compA = $(a).text().toUpperCase();
+ var compB = $(b).text().toUpperCase();
+ return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
+ })
+ $.each(listitems, function(idx, itm) { mylist.prepend(itm); });
+ }
+
function initCharacter(id){
var me = new Sprite();
me.initialize(id, MrJaba.Bomberman.Images.getImage('CharacterBoy'), canvasNode());
@@ -164,9 +178,10 @@ MrJaba.Bomberman = function(){
$.each(positions, function(uuid, position){
if( isOpponent(uuid) ){ MrJaba.Bomberman.opponents[uuid] = {x:parseInt(position.x), y:parseInt(position.y)} }
if( iAmRestarting(uuid, position) ){ restartMe(position); }
- var style = ( uuid === MrJaba.Bomberman.uuid ) ? "background-color:red;" : ""
- $("#scores").prepend("<ul style='"+style+"'>"+uuid+':'+position.score+"</ul>");
+ var li_class = ( uuid === MrJaba.Bomberman.uuid ) ? "me" : "opponent"
+ $("#scores").prepend("<li class='"+li_class+"'><span class='score'>"+position.score+"</span><span class='uuid'>"+uuid+"</span></li>");
})
+ sortScores();
},
fetchBombAt: function(x, y){
Please sign in to comment.
Something went wrong with that request. Please try again.