Light meter

This commit is contained in:
2014-06-14 19:27:31 -07:00
parent 394fd13f4e
commit b76fe63520

View File

@@ -1099,15 +1099,20 @@ GameState.prototype.check_input = function()
GameState.prototype.update = function() GameState.prototype.update = function()
{ {
this.check_input(); this.check_input();
this.shadowTexture.update(player.x-1, player.y-1, 34, 34); lightness = 0;
lightcheck = [ this.shadowTexture.processPixelRGB(
this.shadowTexture.getPixelRGB(player.x, player.y), function(x) {
this.shadowTexture.getPixelRGB(player.x + 32, player.y), var val = (x['r'] + x['g'] + x['b']) / 3;
this.shadowTexture.getPixelRGB(player.x + 32, player.y + 32), if ( val > lightness )
this.shadowTexture.getPixelRGB(player.x, player.y + 32) lightness = val;
]; },
this,
console.log(lightcheck); player.x,
player.y,
32,
32);
console.log(lightness);
for (var ln in this.map_collision_layers ) { for (var ln in this.map_collision_layers ) {
layer = this.map_collision_layers[ln]; layer = this.map_collision_layers[ln];