diff options
author | Tom Barrett <tombarrett@siu.edu> | 2017-11-23 02:58:34 -0600 |
---|---|---|
committer | Tom Barrett <tombarrett@siu.edu> | 2017-11-23 02:58:34 -0600 |
commit | 72ea9deb1cf959602a038e5141a86228186a35b3 (patch) | |
tree | a2169071db31acf4c8810a6b6ee740fcf0ab3a0b /src/main.rs | |
parent | 1c3ec15a9a8b7cef3c544af225d028b3de13d75e (diff) |
-added pathfinding
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index ac74781..7044467 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,7 @@ fn main() { let mut map = Map::new(); let mut view = View::new(main.get_max_yx(), &map.window); - let mut cursor = Character::new('X', Colors::White as u8, Location{ x : 150, y : 150}); + let mut cursor = Character::new('X', Colors::White as u8, Location(150, 150)); let mut list = List::new(map.impassable.to_vec()); @@ -44,10 +44,10 @@ fn main() { match main.getch() { Some(Input::Character(c)) => { match c { - 'h' => cursor.location.y -= 1, - 'l' => cursor.location.y += 1, - 'k' => cursor.location.x -= 1, - 'j' => cursor.location.x += 1, + 'h' => cursor.location.1 -= 1, + 'l' => cursor.location.1 += 1, + 'k' => cursor.location.0 -= 1, + 'j' => cursor.location.0 += 1, 'q' => break, _ => (), } @@ -64,7 +64,7 @@ fn main() { } map.draw(&cursor); - view.center(cursor, &map.window); + view.center(cursor.clone(), &map.window); } endwin(); |