Refactor the light calculations to be part of map instead of spread out all over. Still need to bring back lighting on walls and also pathing for enemies is currently busted.
This commit is contained in:
parent
0e8a2e520a
commit
54fa1a23ce
7 changed files with 168 additions and 112 deletions
8
main.cpp
8
main.cpp
|
@ -7,6 +7,7 @@
|
|||
#include "collider.hpp"
|
||||
#include "render.hpp"
|
||||
#include "save.hpp"
|
||||
#include "lights.hpp"
|
||||
#include "ftxui/screen/terminal.hpp" // for SetColorSupport, Color, TrueColor
|
||||
#include <filesystem>
|
||||
#include <fcntl.h>
|
||||
|
@ -16,6 +17,7 @@
|
|||
#endif
|
||||
|
||||
using namespace ftxui;
|
||||
using lighting::LightSource;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
/*
|
||||
|
@ -33,7 +35,7 @@ void configure_world(DinkyECS::World &world, Map &game_map) {
|
|||
world.set<Combat>(player.entity, {100, 10});
|
||||
world.set<Tile>(player.entity, {config.PLAYER_TILE});
|
||||
world.set<Inventory>(player.entity, {5});
|
||||
world.set<LightSource>(player.entity, {50});
|
||||
world.set<LightSource>(player.entity, {5,2});
|
||||
|
||||
auto enemy = world.entity();
|
||||
world.set<Position>(enemy, {game_map.place_entity(1)});
|
||||
|
@ -46,7 +48,7 @@ void configure_world(DinkyECS::World &world, Map &game_map) {
|
|||
world.set<Motion>(enemy2, {0,0});
|
||||
world.set<Combat>(enemy2, {20, 10});
|
||||
world.set<Tile>(enemy2, {"*"});
|
||||
world.set<LightSource>(enemy2, {100});
|
||||
world.set<LightSource>(enemy2, {6,1});
|
||||
|
||||
auto gold = world.entity();
|
||||
world.set<Position>(gold, {game_map.place_entity(3)});
|
||||
|
@ -56,7 +58,7 @@ void configure_world(DinkyECS::World &world, Map &game_map) {
|
|||
|
||||
auto wall_torch = world.entity();
|
||||
world.set<Position>(wall_torch, {game_map.place_entity(4)});
|
||||
world.set<LightSource>(wall_torch, {200});
|
||||
world.set<LightSource>(wall_torch, {2,3});
|
||||
world.set<Tile>(wall_torch, {"!"});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue