v0.5.0: fog of war and tile blocking now update when a tile is discovered

This commit is contained in:
Evan Debenham 2016-12-29 03:54:16 -05:00
parent c2aaae4549
commit b994e20a08
2 changed files with 18 additions and 11 deletions

View File

@ -229,6 +229,12 @@ public class GameScene extends PixelScene {
}
}
walls = new DungeonWallsTilemap();
add(walls);
wallBlocking = new WallBlockingTilemap();
add (wallBlocking);
add( emitters );
add( effects );
@ -240,11 +246,6 @@ public class GameScene extends PixelScene {
addBlobSprite( blob );
}
walls = new DungeonWallsTilemap();
add(walls);
wallBlocking = new WallBlockingTilemap();
add (wallBlocking);
fog = new FogOfWar( Dungeon.level.width(), Dungeon.level.height() );
add( fog );
@ -707,6 +708,8 @@ public class GameScene extends PixelScene {
scene.tiles.updateMapCell( cell );
scene.terrainFeatures.updateMapCell( cell );
scene.walls.updateMapCell( cell );
scene.fog.updateFogCell( cell );
scene.wallBlocking.updateMapCell( cell );
}
}

View File

@ -119,6 +119,10 @@ public class FogOfWar extends Image {
updated.set( 0, 0, mapWidth, mapHeight );
}
public synchronized void updateFogCell( int cell ){
updated.set( cell % mapWidth , cell / mapHeight, (cell % mapWidth)+1, (cell / mapHeight)+1 );
}
public synchronized void updateFogArea(int x, int y, int w, int h){
updated.union(x, y);
updated.union(x + w, y + h);