Add positional sounds from the tilemap

This commit is contained in:
2014-06-13 23:08:13 -07:00
parent 9eafe3f3cc
commit bab6f826ba

View File

@@ -127,12 +127,12 @@ SoundSprite.prototype.adjust_relative_to = function(spr) {
var hyp_right = Math.sqrt((xd_right * xd_right) + (yd_bottom * yd_bottom)); var hyp_right = Math.sqrt((xd_right * xd_right) + (yd_bottom * yd_bottom));
var hyp_left = Math.sqrt((xd_left * xd_left) + (yd_top * yd_top)); var hyp_left = Math.sqrt((xd_left * xd_left) + (yd_top * yd_top));
console.log([hyp_perfect, hyp_left, hyp_right]);
if ( hyp_right > hyp_left ) { if ( hyp_right > hyp_left ) {
this.sound.volume = Number(hyp_perfect / hyp_left); this.sound.volume = Number(hyp_perfect / hyp_left);
} else { } else {
this.sound.volume = Number(hyp_perfect / hyp_right); this.sound.volume = Number(hyp_perfect / hyp_right);
} }
console.log([hyp_perfect, hyp_left, hyp_right, this.sound.volume]);
} }
var moonlightSettings = { var moonlightSettings = {