diff --git a/src/main.rs b/src/main.rs index 283197b..02b361f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,15 +26,11 @@ async fn main() { loop { // fade trails (doesnt really work) let frame_time = get_frame_time(); - for x in 0..MAP_WIDTH { - for y in 0..MAP_HEIGHT { - let mut current_pixel = trail_map.get_pixel(x, y); - current_pixel.r -= 0.1 * frame_time; - current_pixel.g -= 0.1 * frame_time; - current_pixel.b -= 0.1 * frame_time; - trail_map.set_pixel(x, y, current_pixel); + trail_map.bytes.iter_mut().for_each(|b| { + if *b > 0 { + *b -= 1; } - } + }); // actions ants.iter_mut().for_each(|ant| { ant.walk(frame_time, &mut trail_map);