|
|
|
@ -117,9 +117,11 @@ void System::collision(DinkyECS::World &world, Player &player) { |
|
|
|
|
auto loot = world.get<Loot>(entity); |
|
|
|
|
auto &loot_pos = world.get<Position>(entity); |
|
|
|
|
auto &inventory = world.get<Inventory>(player.entity); |
|
|
|
|
auto &light = world.get<LightSource>(player.entity); |
|
|
|
|
|
|
|
|
|
world.send<Events::GUI>(Events::GUI::LOOT, entity, loot); |
|
|
|
|
inventory.gold += loot.amount; |
|
|
|
|
light.strength = 100; |
|
|
|
|
collider.remove(loot_pos.location); |
|
|
|
|
} else { |
|
|
|
|
println("UNKNOWN COLLISION TYPE {}", entity); |
|
|
|
@ -145,6 +147,7 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, ftxui::Canvas &canv |
|
|
|
|
const auto& config = world.get_the<MapConfig>(); |
|
|
|
|
const auto& player = world.get_the<Player>(); |
|
|
|
|
const auto& player_position = world.get<Position>(player.entity); |
|
|
|
|
const auto& player_light = world.get<LightSource>(player.entity); |
|
|
|
|
Point start = game_map.center_camera(player_position.location, view_x, view_y); |
|
|
|
|
auto &walls = game_map.walls(); |
|
|
|
|
auto &paths = game_map.paths(); |
|
|
|
@ -161,11 +164,10 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, ftxui::Canvas &canv |
|
|
|
|
// it gets brighter.
|
|
|
|
|
const int LIGHT_MIN = 10; |
|
|
|
|
const int LIGHT_MAX = 110; |
|
|
|
|
int light_strength = 100; // lower is stronger
|
|
|
|
|
|
|
|
|
|
Point light_at{start.x+x, start.y+y}; |
|
|
|
|
int dnum = paths[light_at.y][light_at.x]; |
|
|
|
|
int light_value = std::clamp(255 - (dnum * light_strength), LIGHT_MIN, LIGHT_MAX); |
|
|
|
|
int light_value = std::clamp(255 - (dnum * player_light.strength), LIGHT_MIN, LIGHT_MAX); |
|
|
|
|
|
|
|
|
|
// "WALL_TILE": "\u2591",
|
|
|
|
|
// "WALL_TILE": "\ua5b8",
|
|
|
|
|