Basic inventory system working and can pick up items but needs to be reflected in the UI next.
This commit is contained in:
parent
d7353a02df
commit
135d9a128b
14 changed files with 212 additions and 48 deletions
26
main.cpp
26
main.cpp
|
@ -13,6 +13,7 @@
|
|||
#include "ftxui/screen/terminal.hpp" // for SetColorSupport, Color, TrueColor
|
||||
#include <filesystem>
|
||||
#include <fcntl.h>
|
||||
#include <fmt/core.h>
|
||||
|
||||
using namespace ftxui;
|
||||
using namespace components;
|
||||
|
@ -33,8 +34,15 @@ void configure_world(DinkyECS::World &world, Map &game_map) {
|
|||
world.set<Motion>(player.entity, {0, 0});
|
||||
world.set<Combat>(player.entity, {100, 10});
|
||||
world.set<Tile>(player.entity, {config.enemies["PLAYER_TILE"]["display"]});
|
||||
world.set<Inventory>(player.entity, {5});
|
||||
world.set<LightSource>(player.entity, {70,1.0});
|
||||
world.set<Inventory>(player.entity, {5});
|
||||
|
||||
auto sword = world.entity();
|
||||
auto pos = game_map.place_entity(1);
|
||||
world.set<Position>(sword, {pos.x+1, pos.y+1});
|
||||
world.set<Tile>(sword, {config.items["SWORD_RUSTY"]["display"]});
|
||||
world.set<InventoryItem>(sword, {1, config.items["SWORD_RUSTY"]});
|
||||
world.set<Weapon>(sword, {20});
|
||||
|
||||
auto enemy = world.entity();
|
||||
world.set<Position>(enemy, {game_map.place_entity(1)});
|
||||
|
@ -52,26 +60,12 @@ void configure_world(DinkyECS::World &world, Map &game_map) {
|
|||
auto gold = world.entity();
|
||||
world.set<Position>(gold, {game_map.place_entity(3)});
|
||||
world.set<Loot>(gold, {100});
|
||||
world.set<Tile>(gold, {config.items["CHEST"]["display"]});
|
||||
world.set<Tile>(gold, {config.items["CHEST_SMALL"]["display"]});
|
||||
|
||||
auto wall_torch = world.entity();
|
||||
world.set<Position>(wall_torch, {game_map.place_entity(4)});
|
||||
world.set<LightSource>(wall_torch, {90,3.0f});
|
||||
world.set<Tile>(wall_torch, {config.items["WALL_TORCH"]["display"]});
|
||||
|
||||
auto torch = world.entity();
|
||||
Point at = game_map.place_entity(2);
|
||||
world.set<Position>(torch, {{at.x+1, at.y+1}});
|
||||
world.set<Loot>(torch, {{0}});
|
||||
world.set<LightSource>(torch, {70,1.5f});
|
||||
world.set<Tile>(torch, {config.items["TORCH"]["display"]});
|
||||
|
||||
auto sword = world.entity();
|
||||
at = game_map.place_entity(1);
|
||||
world.set<Position>(sword, {at.x+1, at.y+1});
|
||||
world.set<Weapon>(sword, {.damage=20});
|
||||
world.set<Loot>(sword, {{0}});
|
||||
world.set<Tile>(sword, {config.items["SWORD"]["display"]});
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue