From b0d5b96ae8bee29ad4acc54636588bc054c33023 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sat, 14 Jun 2014 17:06:04 -0700 Subject: [PATCH] Fixing a bug where lights disappeared too soon --- moonlight/js/moonlight-skulk.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/moonlight/js/moonlight-skulk.js b/moonlight/js/moonlight-skulk.js index 81405c9..318a800 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -935,7 +935,12 @@ GameState.prototype.updateShadowTexture = function() { this.staticLights.forEach(function(light) { if ( light.always_render !== true ) { - if ( ! light.inCamera ) { + var r1 = new Phaser.Rectangle(this.game.camera.x, + this.game.camera.y, + this.game.camera.width, + this.game.camera.height); + if ( ! light.rect.intersects(r1) ) { + console.log("Light does not appear on camera"); return; } }