From 4bcbbaebb809d98abdb15824c89b81266c6f9ce9 Mon Sep 17 00:00:00 2001 From: crumblingstatue Date: Mon, 17 Apr 2023 16:05:01 +0200 Subject: [PATCH] Add more items --- src/game.rs | 15 +++++++++++++++ src/inventory.rs | 19 +++++++++++++++++++ tiles.dat | Bin 261 -> 289 bytes 3 files changed, 34 insertions(+) diff --git a/src/game.rs b/src/game.rs index 8a69efd..756dc40 100644 --- a/src/game.rs +++ b/src/game.rs @@ -69,6 +69,21 @@ impl GameState { if input.pressed(Key::Num5) { self.selected_inv_slot = 4; } + if input.pressed(Key::Num6) { + self.selected_inv_slot = 5; + } + if input.pressed(Key::Num7) { + self.selected_inv_slot = 6; + } + if input.pressed(Key::Num8) { + self.selected_inv_slot = 7; + } + if input.pressed(Key::Num9) { + self.selected_inv_slot = 8; + } + if input.pressed(Key::Num0) { + self.selected_inv_slot = 9; + } self.world.ticks += 1; } pub(crate) fn draw_world(&mut self, rt: &mut RenderTexture, res: &mut Res) { diff --git a/src/inventory.rs b/src/inventory.rs index 6c4f841..00cd56b 100644 --- a/src/inventory.rs +++ b/src/inventory.rs @@ -42,6 +42,14 @@ impl Inventory { id: items::PLATFORM, qty: 100, }, + Slot { + id: items::STONE_WALL, + qty: 100, + }, + Slot { + id: items::PANZERIUM, + qty: 100, + }, ], } } @@ -126,6 +134,15 @@ impl Default for ItemDb { }, consumable: true, }, + ItemDef { + name: String::from("Stone wall"), + graphic_name: String::from("tiles/stoneback"), + tex_rect: IntRect::default(), + use_action: UseAction::PlaceBgTile { + id: BgTileId::STONE, + }, + consumable: true, + }, ], } } @@ -138,4 +155,6 @@ pub mod items { pub const TORCH: ItemId = 1; pub const PLATFORM: ItemId = 2; pub const WOOD_PICK: ItemId = 3; + pub const PANZERIUM: ItemId = 4; + pub const STONE_WALL: ItemId = 5; } diff --git a/tiles.dat b/tiles.dat index b3e41da1d76ee56fb27bc4b71d50dc9a1a74e57d..f820f387c2eee833caceea2c8a20b78c6a20a225 100644 GIT binary patch delta 41 ycmZo=TF5kEGUL>VQwn6K99UnHnUh+qUyztrm0FZpnmgqzBd0=q?4&~nCIA3wG!d@= delta 13 VcmZ3;)XFqrGUJqqQwkU-001IO1qlEE