reduce debug spam again, use info! to emit collision map, works on web
This commit is contained in:
parent
2f727e403d
commit
f48ac15cb7
1 changed files with 14 additions and 11 deletions
|
@ -184,12 +184,12 @@ impl LevelWalls {
|
|||
}
|
||||
|
||||
pub fn debug_collisions(&self, player_pos: &GridCoords) {
|
||||
info!(
|
||||
debug!(
|
||||
"map for a level that is x: {} by y: {}",
|
||||
self.level_width, self.level_height
|
||||
);
|
||||
info!("player pos: {:?}", player_pos);
|
||||
println!(
|
||||
debug!("player pos: {:?}", player_pos);
|
||||
debug!(
|
||||
"level world coordinates: x: {} y: {}",
|
||||
self.level_tile_pos_x, self.level_tile_pos_y
|
||||
);
|
||||
|
@ -198,24 +198,27 @@ impl LevelWalls {
|
|||
player_pos.x - self.level_tile_pos_x,
|
||||
player_pos.y - (-self.level_tile_pos_y - self.level_height),
|
||||
);
|
||||
println!("Player absolute coords: {:?}", *player_pos);
|
||||
println!("Player relative coords: {player_translated_coords:?}");
|
||||
debug!("Player absolute coords: {:?}", *player_pos);
|
||||
info!("Player relative coords: {player_translated_coords:?}");
|
||||
for y in (0..self.level_height).rev() {
|
||||
let mut lineoutput = String::from("");
|
||||
for x in 0..self.level_width {
|
||||
// let coords = GridCoords::new(x + self.level_tile_pos_x, y + self.level_tile_pos_y);
|
||||
let coords = GridCoords::new(x, y);
|
||||
if coords.x == 0 {
|
||||
print!("[X :{:03} Y: {:03}] ", coords.x, coords.y);
|
||||
// print!("[X :{:03} Y: {:03}] ", coords.x, coords.y);
|
||||
lineoutput = format!("{lineoutput}[X :{:03} Y: {:03}] ", coords.x, coords.y);
|
||||
}
|
||||
if coords == player_translated_coords {
|
||||
print!("@");
|
||||
lineoutput = format!("{lineoutput}@");
|
||||
} else if self.in_wall(&coords) {
|
||||
print!("X");
|
||||
lineoutput = format!("{lineoutput}X");
|
||||
} else {
|
||||
print!("_");
|
||||
lineoutput = format!("{lineoutput}_");
|
||||
}
|
||||
if coords.x == (self.level_width - 1) {
|
||||
println!("[X :{:03} Y: {:03}] ", coords.x, coords.y);
|
||||
// println!("[X :{:03} Y: {:03}] ", coords.x, coords.y);
|
||||
lineoutput = format!("{lineoutput} [X :{:03} Y: {:03}]", coords.x, coords.y);
|
||||
info!("{lineoutput}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue