feat: pellet consumption, score & map mutation

This commit is contained in:
2025-07-18 20:15:50 -05:00
parent 62b2c607a9
commit 8808a1aa3b
3 changed files with 74 additions and 14 deletions

View File

@@ -53,6 +53,18 @@ impl Map {
Some(self.inner[x][y])
}
pub fn set_tile(&mut self, cell: (i32, i32), tile: MapTile) -> bool {
let x = cell.0 as usize;
let y = cell.1 as usize;
if x >= BOARD_WIDTH as usize || y >= BOARD_HEIGHT as usize {
return false;
}
self.inner[x][y] = tile;
true
}
pub fn cell_to_pixel(cell: (u32, u32)) -> (i32, i32) {
((cell.0 as i32) * 24, ((cell.1 + 3) as i32) * 24)
}