diff --git a/moonlight/gfx/ui/clock_hourhand.png b/moonlight/gfx/ui/clock_hourhand.png new file mode 100644 index 0000000..a250d43 Binary files /dev/null and b/moonlight/gfx/ui/clock_hourhand.png differ diff --git a/moonlight/gfx/ui/clock_minutehand.png b/moonlight/gfx/ui/clock_minutehand.png new file mode 100644 index 0000000..cbbe14c Binary files /dev/null and b/moonlight/gfx/ui/clock_minutehand.png differ diff --git a/moonlight/gfx/ui/clock_overlay.png b/moonlight/gfx/ui/clock_overlay.png new file mode 100644 index 0000000..34d9e5b Binary files /dev/null and b/moonlight/gfx/ui/clock_overlay.png differ diff --git a/moonlight/gfx/ui/hud.png b/moonlight/gfx/ui/hud.png index 668f5e5..7904e7d 100644 Binary files a/moonlight/gfx/ui/hud.png and b/moonlight/gfx/ui/hud.png differ diff --git a/moonlight/src/GameStates.js b/moonlight/src/GameStates.js index 678ef28..659952d 100644 --- a/moonlight/src/GameStates.js +++ b/moonlight/src/GameStates.js @@ -127,18 +127,38 @@ GameState.prototype.create = function() this); this.clockTimer.start(); - this.hud = this.game.add.image(0, game.camera.height - 68, 'hud', 0, this.uigroup); + var hudoffset = game.camera.height - 68; + this.hud = this.game.add.image(0, hudoffset, 'hud', 0, this.uigroup); + this.hud_hourhand = this.game.add.sprite(39, + hudoffset + 36, + 'clock_hourhand', + 0, + this.uigroup); + this.hud_hourhand.anchor.setTo(0.5, 0.5); + this.hud_minutehand = this.game.add.sprite(39, + hudoffset + 36, + 'clock_minutehand', + 0, + this.uigroup); + this.hud_minutehand.anchor.setTo(0.5, 0.5); + this.hud_clockoverlay = this.game.add.image(39, + hudoffset + 36, + 'clock_overlay', + 0, + this.uigroup); + this.hud_clockoverlay.anchor.setTo(0.5, 0.5); + this.fpsText = this.game.add.text( 20, 20, '', { font: '16px Arial', fill: '#ffffff' }, this.uigroup ); - this.clockText = this.game.add.text( - 20, SCREEN_HEIGHT - 40, '', { font : '16px Arial', fill: '#ffffff' }, this.uigroup - ); + // this.clockText = this.game.add.text( + // 20, SCREEN_HEIGHT - 40, '', { font : '16px Arial', fill: '#ffffff' }, this.uigroup + // ); this.scoreText = this.game.add.text( SCREEN_WIDTH - 80, SCREEN_HEIGHT - 30, '', - { font: '16px Arial', fill: '#ffffff' }, this.uigroup + { font: '16px Arial', fill: '#ffffff' }, this.uigrpoup ); // this.lightbox = this.game.add.image(game.camera.width / 2 - 50, @@ -441,7 +461,12 @@ GameState.prototype.update = function() if (game.time.fps !== 0) { this.fpsText.setText(game.time.fps + ' FPS'); } - this.clockText.setText("" + this.clock.getHours() + ":" + this.clock.getMinutes() + ":" + this.clock.getSeconds()); + var clockhour = this.clock.getHours(); + if ( this.clock.getHours() > 12 ) + clockhour -= 12; + this.hud_hourhand.frame = parseInt((5 * clockhour) + (0.083 * this.clock.getMinutes())); + this.hud_minutehand.frame = this.clock.getMinutes(); + // this.clockText.setText("" + this.clock.getHours() + ":" + this.clock.getMinutes() + ":" + this.clock.getSeconds()); this.scoreText.setText("" + player.score); } diff --git a/moonlight/src/Settings.js b/moonlight/src/Settings.js index bc689c3..203d569 100644 --- a/moonlight/src/Settings.js +++ b/moonlight/src/Settings.js @@ -155,6 +155,10 @@ var moonlightSettings = { 'name': 'hud', 'path': 'gfx/ui/hud.png' }, + { + 'name': 'clock_overlay', + 'path': 'gfx/ui/clock_overlay.png' + }, { 'name': 'lightbar', 'path': 'gfx/ui/lightbar.png' @@ -165,6 +169,20 @@ var moonlightSettings = { } ], 'spritesheets': [ + { + 'name': 'clock_minutehand', + 'path': 'gfx/ui/clock_minutehand.png', + 'width': 64, + 'height': 64, + 'frames': 60 + }, + { + 'name': 'clock_hourhand', + 'path': 'gfx/ui/clock_hourhand.png', + 'width': 64, + 'height': 64, + 'frames': 60 + }, { 'name': 'flame', 'path': 'gfx/effects/flame.png',