Allow monsters to break blocks
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b62f2759de
commit
82c4358ac7
2 changed files with 8 additions and 1 deletions
|
@ -236,6 +236,11 @@ impl Map {
|
||||||
self.tiles[self.point2d_to_index(point)]
|
self.tiles[self.point2d_to_index(point)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_tile_at_mut(&mut self, point: Point) -> &mut TileType {
|
||||||
|
let index = self.point2d_to_index(point);
|
||||||
|
&mut self.tiles[index]
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_tile_at(&mut self, point: Point, tile: TileType) {
|
pub fn set_tile_at(&mut self, point: Point, tile: TileType) {
|
||||||
let index = self.point2d_to_index(point);
|
let index = self.point2d_to_index(point);
|
||||||
self.tiles[index] = tile;
|
self.tiles[index] = tile;
|
||||||
|
|
|
@ -88,10 +88,12 @@ impl<'a> System<'a> for MonsterAiSystem {
|
||||||
let _ = entities.delete(*entity);
|
let _ = entities.delete(*entity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match map.get_tile_at(destination) {
|
let tile = map.get_tile_at_mut(destination);
|
||||||
|
match tile {
|
||||||
TileType::Wall => {}
|
TileType::Wall => {}
|
||||||
TileType::Block => {
|
TileType::Block => {
|
||||||
// TODO: Sound
|
// TODO: Sound
|
||||||
|
*tile = TileType::Floor;
|
||||||
let _ = entities.delete(*entity);
|
let _ = entities.delete(*entity);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue