Changed shadow size to overlap camera edges, changed fill size to speed up filling

This commit is contained in:
Andrew Kesterson
2014-06-11 10:11:34 -07:00
parent e14e154b71
commit 4583f32c79

View File

@@ -218,7 +218,7 @@ GameState.prototype.create = function()
20, 20, '', { font: '16px Arial', fill: '#ffffff' } 20, 20, '', { font: '16px Arial', fill: '#ffffff' }
); );
this.shadowTexture = game.add.bitmapData(game.world.width, game.world.height); this.shadowTexture = game.add.bitmapData(game.world.width + 100, game.world.height + 100);
// Create an object that will use the bitmap as a texture // Create an object that will use the bitmap as a texture
this.shadowSprite = game.add.image(0, 0, this.shadowTexture); this.shadowSprite = game.add.image(0, 0, this.shadowTexture);
@@ -244,7 +244,10 @@ GameState.prototype.updateShadowTexture = function() {
// Draw shadow // Draw shadow
this.shadowTexture.context.fillStyle = 'rgb(100, 100, 100)'; this.shadowTexture.context.fillStyle = 'rgb(100, 100, 100)';
this.shadowTexture.context.fillRect(0, 0, game.width, game.height); this.shadowTexture.context.fillRect(game.camera.x - 50,
game.camera.y - 50,
game.width + 50,
game.height + 50);
// Iterate through each of the lights and draw the glow // Iterate through each of the lights and draw the glow
this.lights.forEach(function(light) { this.lights.forEach(function(light) {