From bd39a5f5bf71e10a73dafb98c5f8ec88aa3bc7fa Mon Sep 17 00:00:00 2001 From: tom barrett Date: Tue, 27 Feb 2018 07:54:45 -0600 Subject: -added ability for ships to slow their velocity vector with one keypress --- src/connection.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/connection.rs') diff --git a/src/connection.rs b/src/connection.rs index bcd4a30..8cf2a15 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -68,12 +68,13 @@ impl Connection { let mut data = String::new(); match self.buff_r.read_line(&mut data) { Ok(result) => match data.as_bytes() { - b"5\n" => acceleration.0 += 1.0, - b"0\n" => acceleration.0 -= 1.0, - b"8\n" => acceleration.1 += 1.0, - b"2\n" => acceleration.1 -= 1.0, - b"4\n" => acceleration.2 += 1.0, - b"6\n" => acceleration.2 -= 1.0, + b"5\n" => acceleration.0 += 0.1, + b"0\n" => acceleration.0 -= 0.1, + b"8\n" => acceleration.1 += 0.1, + b"2\n" => acceleration.1 -= 0.1, + b"4\n" => acceleration.2 += 0.1, + b"6\n" => acceleration.2 -= 0.1, + b"-\n" => masses[self.index].slow(), _ => { if result == 0 { self.open = false; -- cgit v1.2.3