Skip to content

Commit

Permalink
A note on warring. Warring players show their (kills,deaths)
Browse files Browse the repository at this point in the history
  • Loading branch information
billstclair committed Apr 22, 2012
1 parent 53f36c4 commit c55c77a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions index.html
Expand Up @@ -310,6 +310,10 @@ <h2>jsMaze</h2>
double tap.<br/>
To change maze (disconnected only), click to toggle walls on
lower view.</p>
<p>Peaceful players can see only other peaceful players.<br/>
Players at war (after you press the "War" button),<br/>
can see only other players at war. Don't you wish<br/>
the real world worked that way?</p>
<p>Code is at <a href='https://github.com/billstclair/jsmaze'>github.com/billstclair/jsmaze</a>.<br/>
IRC at <a href="irc://irc.freenode.net/#jsMaze">irc.freenode.net/#jsMaze</a></p>
</center>
Expand Down
9 changes: 8 additions & 1 deletion js/jsClientMaze.js
Expand Up @@ -1037,7 +1037,14 @@ var jsClientMaze = {};

function drawPlayerName(ctx, playerOrName, dy, left, top, width) {
var name = playerOrName;
if (typeof(name) != 'string') name = playerOrName.name;
if (typeof(name) != 'string') {
name = playerOrName.name;
if (playerOrName.warring) {
var score = playerOrName.score;
name += ' (' + (score ? score.kills : 0) +
',' + (score ? score.deaths : 0) + ')';
}
}
ctx.fillStyle = 'purple';
ctx.font = Math.floor(dy) + 'px Arial';
var textWidth = ctx.measureText(name).width;
Expand Down

0 comments on commit c55c77a

Please sign in to comment.