You can now go down stairs to new levels, but when you do you become stairs or a random monster.
This commit is contained in:
parent
c14efee9ea
commit
2825faf038
7 changed files with 100 additions and 49 deletions
|
@ -3,20 +3,40 @@
|
|||
#include "constants.hpp"
|
||||
#include "save.hpp"
|
||||
#include "systems.hpp"
|
||||
#include "components.hpp"
|
||||
|
||||
using lighting::LightRender;
|
||||
using std::shared_ptr, std::make_shared;
|
||||
using namespace components;
|
||||
|
||||
LevelManager::LevelManager() {
|
||||
create_level();
|
||||
}
|
||||
|
||||
|
||||
size_t LevelManager::create_level() {
|
||||
size_t LevelManager::create_level(shared_ptr<DinkyECS::World> prev_world) {
|
||||
auto world = make_shared<DinkyECS::World>();
|
||||
save::load_configs(*world);
|
||||
|
||||
auto map = make_shared<Map>(GAME_MAP_X, GAME_MAP_Y);
|
||||
|
||||
if(prev_world != nullptr) {
|
||||
auto player = prev_world->get_the<Player>();
|
||||
world->set_the<Player>(player);
|
||||
|
||||
auto inventory = prev_world->get<Inventory>(player.entity);
|
||||
world->set<Inventory>(player.entity, inventory);
|
||||
|
||||
world->set_the<Debug>(prev_world->get_the<Debug>());
|
||||
auto& combat = prev_world->get<Combat>(player.entity);
|
||||
world->set<Combat>(player.entity, combat);
|
||||
|
||||
auto& motion = prev_world->get<Motion>(player.entity);
|
||||
world->set<Motion>(player.entity, motion);
|
||||
|
||||
auto& tile = prev_world->get<Tile>(player.entity);
|
||||
world->set<Tile>(player.entity, tile);
|
||||
}
|
||||
|
||||
WorldBuilder builder(*map);
|
||||
builder.generate(*world);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue