survivor

graphical action game for the linux terminal
git clone https://git.ce9e.org/survivor.git

commit
b2ed31eb0d5b555e6e04c92f1c5a3a827e4ceb1e
parent
79551b82c2dab0beb81bb0d7cf06b4ede6ae2d04
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-02-18 22:23
simplify key mapping

Diffstat

M src/main.rs 12 ++++--------

1 files changed, 4 insertions, 8 deletions


diff --git a/src/main.rs b/src/main.rs

@@ -167,14 +167,10 @@ fn main() {
  167   167         let dt = (time1 - time0).as_secs_f32();
  168   168 
  169   169         match input.getch() {
  170    -1             Some(b'w') => { player.dir = Dir::Up },
  171    -1             Some(b'A') => { player.dir = Dir::Up },
  172    -1             Some(b'a') => { player.dir = Dir::Left; player.face = Dir::Left },
  173    -1             Some(b'D') => { player.dir = Dir::Left; player.face = Dir::Left },
  174    -1             Some(b's') => { player.dir = Dir::Down },
  175    -1             Some(b'B') => { player.dir = Dir::Down },
  176    -1             Some(b'd') => { player.dir = Dir::Right; player.face = Dir::Right },
  177    -1             Some(b'C') => { player.dir = Dir::Right; player.face = Dir::Right },
   -1   170             Some(b'w' | b'A') => { player.dir = Dir::Up },
   -1   171             Some(b'a' | b'D') => { player.dir = Dir::Left; player.face = Dir::Left },
   -1   172             Some(b's' | b'B') => { player.dir = Dir::Down },
   -1   173             Some(b'd' | b'C') => { player.dir = Dir::Right; player.face = Dir::Right },
  178   174             Some(b' ') => { player.dir = Dir::Stop },
  179   175             Some(b'q') => { quit(0) },
  180   176             _ => {},