diff --git a/moonlight/gfx/ui/uiGameDisplayBorder.png b/moonlight/gfx/ui/uiGameDisplayBorder.png new file mode 100644 index 0000000..1c7e582 Binary files /dev/null and b/moonlight/gfx/ui/uiGameDisplayBorder.png differ diff --git a/moonlight/index.html b/moonlight/index.html index 196517f..8c8f95f 100644 --- a/moonlight/index.html +++ b/moonlight/index.html @@ -3,14 +3,10 @@ Moonlight Skulk (Working Title) + - @@ -23,6 +19,23 @@ +
+ +
+
+
+ + + + + + + + + +
Audio Volume
Brightness
+
+
diff --git a/moonlight/moonlight.css b/moonlight/moonlight.css new file mode 100644 index 0000000..f0e718a --- /dev/null +++ b/moonlight/moonlight.css @@ -0,0 +1,18 @@ +body { + margin: 0; + background-color: #000000; + color: #c8c8c8; + text-align: center; + width: 800px; + align: center; +} + +#uiGameContainer { + position: absolute; +} + +#uiGameDisplay { + position: absolute; + top: 60px; + left: 55px; +} \ No newline at end of file diff --git a/moonlight/src/GameStates.js b/moonlight/src/GameStates.js index dd1e23d..b795836 100644 --- a/moonlight/src/GameStates.js +++ b/moonlight/src/GameStates.js @@ -126,7 +126,11 @@ GameState.prototype.create = function() GameState.prototype.updateShadowTexture = function() { var cv = this.shadowTextureColor; - this.shadowTexture.context.fillStyle = "rgb(" + cv[0] + "," + cv[1] + "," + cv[2] + ")"; + var uigamma = parseInt(getDOMValue("uiGamma")); + this.shadowTexture.context.fillStyle = ("rgb(" + (cv[0]+uigamma) + + "," + (cv[1]+uigamma) + + "," + (cv[2]+uigamma) + ")" + ); this.shadowTexture.context.fillRect(0, 0, game.world.width, game.world.height); this.staticLights.forEach(function(light) { @@ -203,7 +207,8 @@ GameState.prototype.check_input = function() } GameState.prototype.update_player_lightmeter = function() { - player.lightmeter = (Number(array_average(this.shadowTextureColor)) / 255.0); + var avg_shadow = Number(array_average(this.shadowTextureColor)); + player.lightmeter = ((avg_shadow) / 255.0); lightValue = 0; this.staticLights.forEach(function(light) { var left = player.x; diff --git a/moonlight/src/SoundSprite.js b/moonlight/src/SoundSprite.js index c548126..60b4d79 100644 --- a/moonlight/src/SoundSprite.js +++ b/moonlight/src/SoundSprite.js @@ -54,8 +54,9 @@ SoundSprite.prototype.update_new_values = function() { } SoundSprite.prototype.adjust_relative_to = function(spr) { + var adjustment = 1.0 - Number(parseInt(getDOMValue("uiMusicVolume"))) / 100.0; if ( this.sound_nofade == true ) { - this.sound.volume = this.sound_volume; + this.sound.volume = Math.min(0, this.sound_volume - adjustment); return; } @@ -72,7 +73,7 @@ SoundSprite.prototype.adjust_relative_to = function(spr) { var hyp = Math.sqrt(Number(xd * xd) + Number(yd * yd)); - this.sound.volume = (1.0 - Number(hyp / this.sound_distance)); + this.sound.volume = (1.0 - adjustment - Number(hyp / this.sound_distance)); // Math.max doesn't work here?? if ( this.sound.volume < 0 ) this.sound.volume = 0; diff --git a/moonlight/src/Util.js b/moonlight/src/Util.js index e7fc295..5f2b3d6 100644 --- a/moonlight/src/Util.js +++ b/moonlight/src/Util.js @@ -306,3 +306,7 @@ function isSet(x) return ( (typeof x !== 'undefined') && ( x !== null ) ); } + +function getDOMValue(name) { + return document.getElementById(name).value +} diff --git a/moonlight/src/main.js b/moonlight/src/main.js index d4c75cd..00a16a9 100644 --- a/moonlight/src/main.js +++ b/moonlight/src/main.js @@ -2,7 +2,7 @@ var pathfinder = null; var pathfinder_grid = null; -var game = new Phaser.Game(SCREEN_WIDTH, SCREEN_HEIGHT, Phaser.AUTO, ''); +var game = new Phaser.Game(SCREEN_WIDTH, SCREEN_HEIGHT, Phaser.AUTO, 'uiGameDisplay'); game.state.add('boot', Boot, false); game.state.add('preloader', Preloader, false);