From 21989b263458bbe09f608ccd7c69b5c9431672cc Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Fri, 13 Jun 2014 23:14:55 -0700 Subject: [PATCH] Add positional sounds from the tilemap --- moonlight/js/moonlight-skulk.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/moonlight/js/moonlight-skulk.js b/moonlight/js/moonlight-skulk.js index 04fa45c..67d6a42 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -106,7 +106,7 @@ SoundSprite.prototype.update_new_values = function() { console.log("Sound should be playing"); } -SoundSprite.prototype.adjust_relative_to = function(me, spr) { +SoundSprite.prototype.adjust_relative_to_player = function() { if ( this.sound_nofade == true ) { this.sound.volume = 1.0; return; @@ -116,10 +116,10 @@ SoundSprite.prototype.adjust_relative_to = function(me, spr) { // hypotenuse of a triangle drawn from the point (p) to the // sprite in question - var xd = (spr.x - this.x); + var xd = (game.player.x - this.x); if ( xd < 0 ) xd = -(xd); - var yd = (spr.y - this.y); + var yd = (game.player.y - this.y); if ( yd < 0 ) yd = -(yd); var hyp = Math.sqrt((xd * xd) + (yd * yd));