summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/src/lib.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/game/src/lib.rs b/game/src/lib.rs
index 8465ff3..23cdcfa 100644
--- a/game/src/lib.rs
+++ b/game/src/lib.rs
@@ -1,4 +1,7 @@
-use dungeon::{Dungeon, UpdateResult, player_input::PlayerInput, pos::Direction};
+use dungeon::{
+ Dungeon, UpdateResult, player::PLAYER_INVENTORY_SIZE_USIZE, player_input::PlayerInput,
+ pos::Direction,
+};
use graphics::{Key, Window};
pub struct Game {
@@ -63,7 +66,8 @@ impl Game {
let use_item = self.window.is_key_pressed(Key::E);
let attack = self.window.is_key_pressed(Key::F);
let drop = self.window.is_key_pressed(Key::Q);
- let inv_slot = (0..9).find(|n| self.window.is_key_pressed(Key::Number(*n)));
+ let inv_slot = (0..PLAYER_INVENTORY_SIZE_USIZE)
+ .find(|n| self.window.is_key_pressed(Key::Number(n + 1)));
PlayerInput {
direction,
interact,