From f48ac15cb703c9d6011f53b6cf559327d34e68ca Mon Sep 17 00:00:00 2001 From: RobertoMaurizzi Date: Thu, 17 Jul 2025 17:22:25 +0800 Subject: [PATCH] reduce debug spam again, use info! to emit collision map, works on web --- src/demo/level.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/demo/level.rs b/src/demo/level.rs index 618c650..7a54941 100644 --- a/src/demo/level.rs +++ b/src/demo/level.rs @@ -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}"); } } }