Added audio and brightness controls, also added some crappy UI graphics to the index page
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -306,3 +306,7 @@ function isSet(x)
|
||||
return ( (typeof x !== 'undefined') &&
|
||||
( x !== null ) );
|
||||
}
|
||||
|
||||
function getDOMValue(name) {
|
||||
return document.getElementById(name).value
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user