Add positional sounds from the tilemap
This commit is contained in:
@@ -128,8 +128,10 @@ SoundSprite.prototype.adjust_relative_to = function(spr) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.sound.volume = (1.0 - Number(hyp / hyp_perfect));
|
this.sound.volume = (1.0 - Number(hyp / hyp_perfect));
|
||||||
|
// Math.max doesn't work here??
|
||||||
|
if ( this.sound.volume < 0 )
|
||||||
|
this.sound.volume = 0;
|
||||||
|
|
||||||
console.log([hyp_perfect, hyp, (1.0 - Number(hyp / hyp_perfect)), this.sound.volume]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var moonlightSettings = {
|
var moonlightSettings = {
|
||||||
@@ -929,7 +931,6 @@ GameState.prototype.create = function()
|
|||||||
this.map.createFromObjects('AI', 3544, 'player', 0, true, false, this.aiSprites, AISprite);
|
this.map.createFromObjects('AI', 3544, 'player', 0, true, false, this.aiSprites, AISprite);
|
||||||
this.aiSprites.forEach(function(spr) {
|
this.aiSprites.forEach(function(spr) {
|
||||||
spr.update_new_values();
|
spr.update_new_values();
|
||||||
console.log(spr);
|
|
||||||
}, this)
|
}, this)
|
||||||
};
|
};
|
||||||
if ( lp['collides'] == true ) {
|
if ( lp['collides'] == true ) {
|
||||||
@@ -973,14 +974,12 @@ GameState.prototype.create = function()
|
|||||||
this.map.createFromObjects('Lights', 97, 'player', 0, true, false, this.staticLights, Light);
|
this.map.createFromObjects('Lights', 97, 'player', 0, true, false, this.staticLights, Light);
|
||||||
this.staticLights.forEach(function(light) {
|
this.staticLights.forEach(function(light) {
|
||||||
light.update_new_values();
|
light.update_new_values();
|
||||||
console.log(light);
|
|
||||||
}, this)
|
}, this)
|
||||||
|
|
||||||
this.staticSounds = game.add.group();
|
this.staticSounds = game.add.group();
|
||||||
this.map.createFromObjects('Sounds', 11, 'player', 0, true, false, this.staticSounds, SoundSprite);
|
this.map.createFromObjects('Sounds', 11, 'player', 0, true, false, this.staticSounds, SoundSprite);
|
||||||
this.staticSounds.forEach(function(snd) {
|
this.staticSounds.forEach(function(snd) {
|
||||||
snd.update_new_values();
|
snd.update_new_values();
|
||||||
console.log(snd);
|
|
||||||
}, this)
|
}, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -991,7 +990,6 @@ GameState.prototype.updateShadowTexture = function() {
|
|||||||
this.staticLights.forEach(function(light) {
|
this.staticLights.forEach(function(light) {
|
||||||
if ( light.always_render !== true ) {
|
if ( light.always_render !== true ) {
|
||||||
if ( ! light.inCamera ) {
|
if ( ! light.inCamera ) {
|
||||||
console.log("Light does not appear on camera");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1078,7 +1076,6 @@ GameState.prototype.update = function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _fix_audio_relative(x) {
|
function _fix_audio_relative(x) {
|
||||||
console.log(x);
|
|
||||||
x.adjust_relative_to(player);
|
x.adjust_relative_to(player);
|
||||||
}
|
}
|
||||||
this.staticSounds.forEach(_fix_audio_relative, this);
|
this.staticSounds.forEach(_fix_audio_relative, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user