Light meter

This commit is contained in:
2014-06-14 20:30:17 -07:00
parent ef99e94668
commit 161c7adc1c

View File

@@ -1103,7 +1103,15 @@ GameState.prototype.check_input = function()
GameState.prototype.update_player_lightmeter = function() {
lightValue = 0;
this.staticLights.forEach(function(light) {
line = new Phaser.Line(player.x + 16, player.y + 16, light.x + 16, light.y + 16);
var left = player.x;
var top = player.y;
if ( player.y < this.y )
top = player.y + 32;
if ( player.x + this.x )
left = player.x + 32;
line = new Phaser.Line(left, top, light.x + 16, light.y + 16);
if ( line.length > light.rendered_radius)
return;
var length = line.length;