From 9623439ca70bdeb05bbae535f395333d38930c10 Mon Sep 17 00:00:00 2001 From: logaritmisk Date: Tue, 6 Jan 2015 15:07:32 +0100 Subject: [PATCH] only zero velocity when we should --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1930989..f39fe14 100644 --- a/src/main.rs +++ b/src/main.rs @@ -113,9 +113,9 @@ fn main() { } }, Event::KeyUp(_, _, key, _, _, _) => { - if key == KeyCode::Right { + if key == KeyCode::Right && player.velocity.x > 0.0 { player.velocity.x = 0.0; - } else if key == KeyCode::Left { + } else if key == KeyCode::Left && player.velocity.x < 0.0 { player.velocity.x = 0.0; } else if key == KeyCode::Up { if player.velocity.y < -6.0 {