Run cargo fmt
This commit is contained in:
parent
17e6b5c17c
commit
77a12e1c9f
14
src/main.rs
14
src/main.rs
|
@ -33,9 +33,11 @@ impl Obstacle {
|
|||
let x = self.x - current_x + X_OFFSET;
|
||||
let (y_top_of_bottom, y_bottom_of_top) = self.y_bounds();
|
||||
let y_positions = [0..y_bottom_of_top, y_top_of_bottom..SCREEN_HEIGHT]
|
||||
.map(|r| { r.collect::<Vec<u16>>() })
|
||||
.map(|r| r.collect::<Vec<u16>>())
|
||||
.concat();
|
||||
for y in y_positions { ctx.set(x, y as i32, RED, BLACK, to_cp437('|')); }
|
||||
for y in y_positions {
|
||||
ctx.set(x, y as i32, RED, BLACK, to_cp437('|'));
|
||||
}
|
||||
}
|
||||
|
||||
fn y_bounds(&mut self) -> (u16, u16) {
|
||||
|
@ -120,7 +122,7 @@ impl State {
|
|||
match key {
|
||||
VirtualKeyCode::P => self.restart(),
|
||||
VirtualKeyCode::Q => ctx.quitting = true,
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +174,9 @@ impl State {
|
|||
self.obstacles.iter_mut().for_each(|o| {
|
||||
if o.x == self.player.x {
|
||||
let (y_top_of_bottom, y_bottom_of_top) = o.y_bounds();
|
||||
if (self.player.y as u16) >= y_top_of_bottom || (self.player.y as u16) <= y_bottom_of_top {
|
||||
if (self.player.y as u16) >= y_top_of_bottom
|
||||
|| (self.player.y as u16) <= y_bottom_of_top
|
||||
{
|
||||
did_collide = true;
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +204,7 @@ impl State {
|
|||
match key {
|
||||
VirtualKeyCode::P => self.restart(),
|
||||
VirtualKeyCode::Q => ctx.quitting = true,
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue