From 456c47998bd7836154eedf37765d71eef780b8ae Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sat, 14 Jun 2014 00:09:36 -0700 Subject: [PATCH] Add positional sounds from the tilemap --- moonlight/gfx/bigmap.json | 16 ++++++++++++++++ moonlight/js/moonlight-skulk.js | 10 +++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/moonlight/gfx/bigmap.json b/moonlight/gfx/bigmap.json index 092f0f1..6545917 100644 --- a/moonlight/gfx/bigmap.json +++ b/moonlight/gfx/bigmap.json @@ -211,6 +211,22 @@ "width":0, "x":736, "y":865 + }, + { + "gid":17, + "height":0, + "name":"", + "properties": + { + "sound_key":"background_music", + "sound_nofade":"true", + "sound_volume":"0.5" + }, + "type":"", + "visible":true, + "width":0, + "x":64, + "y":40 }], "opacity":1, "type":"objectgroup", diff --git a/moonlight/js/moonlight-skulk.js b/moonlight/js/moonlight-skulk.js index 2d8577c..737e87b 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -74,11 +74,11 @@ function SoundSprite(game, x, y, key, frame, Phaser.Sprite.call(this, game, x, y, null); this.sound_key = sound_key; this.sound_marker = ( typeof sound_marker == undefined ? sound_marker : ''); - this.sound_volume = ( typeof sound_volume == undefined ? sound_volume : 1.0 ); - this.sound_position = ( typeof sound_position == undefined ? sound_position : 1.0 ); - this.sound_loop = ( typeof sound_loop == undefined ? sound_loop : true ); - this.sound_forcerestart = ( typeof sound_forcerestart == undefined ? sound_forcerestart : true ); - this.sound_nofade = (typeof sound_alwaysplay == undefined ? sound_alwaysplay : false); + this.sound_volume = ( typeof sound_volume == undefined ? Number(sound_volume) : 1.0 ); + this.sound_position = ( typeof sound_position == undefined ? parseInt(sound_position) : 1.0 ); + this.sound_loop = ( typeof sound_loop == undefined ? Boolean(sound_loop) : true ); + this.sound_forcerestart = ( typeof sound_forcerestart == undefined ? Boolean(sound_forcerestart) : true ); + this.sound_nofade = (typeof sound_nofade == undefined ? Boolean(sound_alwaysplay) : false); this.sound = null; }