Skip to content

Commit

Permalink
Leaderboard
Browse files Browse the repository at this point in the history
  • Loading branch information
kq-li committed Apr 3, 2016
1 parent 7286acb commit 5337f92
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions public/js/game/Leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ Leaderboard.prototype.update = function(players) {
this.element.removeChild(this.element.firstChild);
}

var header = document.createElement('h1');
header.appendChild(document.createTextNode('Leaderboard'));
this.element.appendChild(header);

for (var i = 0; i < this.players.length; ++i) {
var playerElement = document.createElement('li');
playerElement.appendChild(document.createTextNode(
this.players[i].name +
": Kills: " + this.players[i].kills +
" Deaths: " + this.players[i].deaths));
": Score: " + this.players[i]['score']));
this.element.appendChild(playerElement);
};
};
10 changes: 10 additions & 0 deletions public/styles/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ html, body {
opacity: 0;
}

#leaderboard {
position: absolute;
width: 20%;
height: 80%;
top: 10%;
left: 5%;
background-color: #eeeeee;
list-style: none;
}

#canvas {
width: 768px;
height: 1024px;
Expand Down
1 change: 1 addition & 0 deletions views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ block body
span About
#container
div#leaderboard
h1 Leaderboard
canvas#canvas

block scripts
Expand Down

0 comments on commit 5337f92

Please sign in to comment.