From 1b890d73eb836a6f5c7588497b7be23663de3086 Mon Sep 17 00:00:00 2001 From: gallant Date: Sat, 21 May 2022 14:01:50 -0500 Subject: [PATCH] fireboy watergirl moment --- src/main.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index e8710e1..eaae9d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,6 +41,10 @@ fn main() { } for key in keys { + let state = match key { + Scancode::Left | Scancode::Right => 0, + _ => 2, + }; let offset = match key { Scancode::Escape => { game.terminate(); @@ -53,17 +57,9 @@ fn main() { _ => (0, 0), }; - let mut spriteindex = sprites.get(0).unwrap(); - /* + let spriteindex = sprites.get_mut(state).unwrap(); - */ - /*pub const fn unwrap(self) -> T { - match self { - Some(val) => val, - None => panic("called `Option::unwrap()` on a `None` value"), - } - }*/ - //spriteindex.translate(offset); + spriteindex.translate(offset); } ctx.set_background_colour( 129, 201, i);