highscore screen is shiny now :)

This commit is contained in:
Ruben Müller 2013-05-16 22:42:54 +02:00
parent cfd4bb887c
commit 544b3d0323
4 changed files with 16 additions and 3 deletions

View file

@ -115,8 +115,11 @@ ig.module(
game_id: '642fc6c1e8',
response: 'json'
},
font: new ig.Font( 'media/lcddot.font.png' ),
fontSmall: new ig.Font( 'media/lcddot.small.font.png' ),
fontSmallGrey: new ig.Font( 'media/lcddot.small.grey.font.png' ),
backgroundInput: new ig.Image('media/highscore_input_screen.png'),
background: new ig.Image('media/highscore_screen.png'),
nameField: null,
@ -167,13 +170,23 @@ ig.module(
else this.background.draw(0, 0);
// Draw the current highscore if its loaded
var num = 1;
if (ig.global.scores !== undefined) {
var ypos = 50;
var font = this.fontSmall;
for (var i=0; i<ig.global.scores.length; i++) {
var score = ig.global.scores[i];
this.fontSmall.draw(score.Score.score + ' ' + score.Player.username, 50, ypos, ig.Font.ALIGN.RIGHT);
this.fontSmall.draw(score.Score.score + ' ' + score.Player.username, 50, ypos, ig.Font.ALIGN.LEFT);
if(num <= 3) font = this.fontSmall;
else font = this.fontSmallGrey;
font.draw(num, 60, ypos, ig.Font.ALIGN.CENTER);
font.draw(score.Score.score, 210, ypos, ig.Font.ALIGN.RIGHT);
font.draw(score.Player.username, 250, ypos, ig.Font.ALIGN.LEFT);
ypos += 30;
num++;
}
}
@ -198,7 +211,7 @@ ig.module(
// XXX: Just for debug purpose
if (ig.input.pressed('highscore')) {
ig.global.score = 1337;
ig.global.score = Math.floor(Math.random()*1000)*1;
ig.system.setGame(ScoreboardScreen);
}
this.parent();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB