v0.5.0: fog of war and tile blocking now update when a tile is discovered
This commit is contained in:
parent
c2aaae4549
commit
b994e20a08
|
@ -229,6 +229,12 @@ public class GameScene extends PixelScene {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
walls = new DungeonWallsTilemap();
|
||||||
|
add(walls);
|
||||||
|
|
||||||
|
wallBlocking = new WallBlockingTilemap();
|
||||||
|
add (wallBlocking);
|
||||||
|
|
||||||
add( emitters );
|
add( emitters );
|
||||||
add( effects );
|
add( effects );
|
||||||
|
|
||||||
|
@ -240,11 +246,6 @@ public class GameScene extends PixelScene {
|
||||||
addBlobSprite( blob );
|
addBlobSprite( blob );
|
||||||
}
|
}
|
||||||
|
|
||||||
walls = new DungeonWallsTilemap();
|
|
||||||
add(walls);
|
|
||||||
|
|
||||||
wallBlocking = new WallBlockingTilemap();
|
|
||||||
add (wallBlocking);
|
|
||||||
|
|
||||||
fog = new FogOfWar( Dungeon.level.width(), Dungeon.level.height() );
|
fog = new FogOfWar( Dungeon.level.width(), Dungeon.level.height() );
|
||||||
add( fog );
|
add( fog );
|
||||||
|
@ -707,6 +708,8 @@ public class GameScene extends PixelScene {
|
||||||
scene.tiles.updateMapCell( cell );
|
scene.tiles.updateMapCell( cell );
|
||||||
scene.terrainFeatures.updateMapCell( cell );
|
scene.terrainFeatures.updateMapCell( cell );
|
||||||
scene.walls.updateMapCell( cell );
|
scene.walls.updateMapCell( cell );
|
||||||
|
scene.fog.updateFogCell( cell );
|
||||||
|
scene.wallBlocking.updateMapCell( cell );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,10 @@ public class FogOfWar extends Image {
|
||||||
updated.set( 0, 0, mapWidth, mapHeight );
|
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){
|
public synchronized void updateFogArea(int x, int y, int w, int h){
|
||||||
updated.union(x, y);
|
updated.union(x, y);
|
||||||
updated.union(x + w, y + h);
|
updated.union(x + w, y + h);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user