Add positional sounds from the tilemap
This commit is contained in:
@@ -90,23 +90,7 @@ SoundSprite.prototype = Object.create(Phaser.Sprite.prototype);
|
||||
SoundSprite.prototype.constructor = Light;
|
||||
|
||||
SoundSprite.prototype.update_new_values = function() {
|
||||
if ( this.sound_key == null ) {
|
||||
if ( this.sound !== null ) {
|
||||
this.sound.stop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.sound = game.add.audio(this.sound_key);
|
||||
this.sound.play(
|
||||
this.sound_marker,
|
||||
this.sound_position,
|
||||
this.sound_volume,
|
||||
this.sound_loop,
|
||||
this.sound_forcerestart);
|
||||
console.log("Sound should be playing");
|
||||
}
|
||||
|
||||
SoundSprite.prototype.adjust_relative_to = function(spr) {
|
||||
this.adjust_relative_to = function(spr) {
|
||||
console.log(spr);
|
||||
if ( this.sound_nofade == true ) {
|
||||
this.sound.volume = 1.0;
|
||||
@@ -132,6 +116,22 @@ SoundSprite.prototype.adjust_relative_to = function(spr) {
|
||||
console.log([hyp_perfect, hyp, this.sound.volume]);
|
||||
}
|
||||
|
||||
if ( this.sound_key == null ) {
|
||||
if ( this.sound !== null ) {
|
||||
this.sound.stop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.sound = game.add.audio(this.sound_key);
|
||||
this.sound.play(
|
||||
this.sound_marker,
|
||||
this.sound_position,
|
||||
this.sound_volume,
|
||||
this.sound_loop,
|
||||
this.sound_forcerestart);
|
||||
console.log("Sound should be playing");
|
||||
}
|
||||
|
||||
var moonlightSettings = {
|
||||
'map' : {
|
||||
'tilesets': [
|
||||
@@ -1078,6 +1078,7 @@ GameState.prototype.update = function()
|
||||
}
|
||||
|
||||
function _fix_audio_relative(x) {
|
||||
console.log(x);
|
||||
x.adjust_relative_to(this.player);
|
||||
}
|
||||
this.staticSounds.forEach(_fix_audio_relative, this);
|
||||
|
||||
Reference in New Issue
Block a user