Enemies now actually adopt their color and all items too.
This commit is contained in:
parent
59a6882b70
commit
7c56f350ab
4 changed files with 29 additions and 15 deletions
|
@ -2,8 +2,8 @@
|
|||
"TORCH_BAD": {
|
||||
"id": "TORCH_BAD",
|
||||
"name": "Crappy Torch",
|
||||
"foreground": [24, 205, 189],
|
||||
"background": [230, 20, 120],
|
||||
"foreground": [24, 120, 189],
|
||||
"background": [230,120, 120],
|
||||
"description": "A torch that barely lights the way. You wonder if it'd be better to not see the person who murders you.",
|
||||
"inventory_count": 1,
|
||||
"components": [
|
||||
|
@ -14,8 +14,8 @@
|
|||
"SWORD_RUSTY": {
|
||||
"id": "SWORD_RUSTY",
|
||||
"name": "Rusty Junk Sword",
|
||||
"foreground": [24, 205, 189],
|
||||
"background": [24, 205, 189],
|
||||
"foreground": [24, 120, 189],
|
||||
"background": [24, 120, 189],
|
||||
"description": "A sword left to rot in a deep hole where it acquired a patina of dirt and tetanus. You aren't sure if it's more deadly for you to hold it or for the people you stab with it.",
|
||||
"inventory_count": 1,
|
||||
"components": [
|
||||
|
@ -26,8 +26,8 @@
|
|||
"SWORD_LIGHT_AND_FLAME": {
|
||||
"id": "SWORD_LIGHT_AND_FLAME",
|
||||
"name": "Sword of Light and Flame",
|
||||
"foreground": [24, 205, 189],
|
||||
"background": [24, 205, 189],
|
||||
"foreground": [24, 205, 210],
|
||||
"background": [24, 205, 210],
|
||||
"description": "A sword so powerful, a great man from the Land of The Rising Sun thrust it into the ocean of Nerf to chill its effects.",
|
||||
"inventory_count": 1,
|
||||
"components": [
|
||||
|
@ -39,8 +39,8 @@
|
|||
"CHEST_SMALL": {
|
||||
"id": "CHEST_SMALL",
|
||||
"name": "Small Chest",
|
||||
"foreground": [24, 205, 189],
|
||||
"background": [24, 205, 189],
|
||||
"foreground": [150, 100, 189],
|
||||
"background": [150, 100, 189],
|
||||
"description": "A small chest of gold. You wonder who would leave something like this around.",
|
||||
"components": [
|
||||
{"type": "Tile", "config": {"chr": "\uaaea"}},
|
||||
|
@ -51,8 +51,8 @@
|
|||
"WALL_TORCH": {
|
||||
"id": "WALL_TORCH",
|
||||
"name": "Basic Wall Torch",
|
||||
"foreground": [24, 205, 189],
|
||||
"background": [24, 205, 189],
|
||||
"foreground": [24, 205, 210],
|
||||
"background": [24, 205, 210],
|
||||
"description": "A torch on a wall you can't pick up.",
|
||||
"inventory_count": 0,
|
||||
"components": [
|
||||
|
@ -63,8 +63,8 @@
|
|||
"POTION_HEALING_SMALL": {
|
||||
"id": "POTION_HEALING_SMALL",
|
||||
"name": "Small Healing Potion",
|
||||
"foreground": [24, 205, 189],
|
||||
"background": [24, 205, 189],
|
||||
"foreground": [255, 205, 189],
|
||||
"background": [255, 205, 189],
|
||||
"description": "A small healing potion.",
|
||||
"inventory_count": 1,
|
||||
"components": [
|
||||
|
|
|
@ -13,7 +13,14 @@ namespace components {
|
|||
} else if(comp_type == "Loot") {
|
||||
world.set<Loot>(entity, {config["amount"]});
|
||||
} else if(comp_type == "Tile") {
|
||||
world.set<Tile>(entity, {config["chr"]});
|
||||
world.set<Tile>(entity, {
|
||||
config["chr"],
|
||||
entity_data["foreground"][0],
|
||||
entity_data["foreground"][1],
|
||||
entity_data["foreground"][2],
|
||||
entity_data["background"][0],
|
||||
entity_data["background"][1],
|
||||
entity_data["background"][2]});
|
||||
} else if(comp_type == "EnemyConfig") {
|
||||
world.set<EnemyConfig>(entity, {config["hearing_distance"]});
|
||||
} else if(comp_type == "Combat") {
|
||||
|
|
|
@ -32,6 +32,13 @@ namespace components {
|
|||
|
||||
struct Tile {
|
||||
std::string chr;
|
||||
uint8_t fg_h = 0;
|
||||
uint8_t fg_s = 0;
|
||||
uint8_t fg_v = 0;
|
||||
uint8_t bg_h = 0;
|
||||
uint8_t bg_s = 0;
|
||||
uint8_t bg_v = 0;
|
||||
|
||||
DEFINE_SERIALIZABLE(Tile, chr);
|
||||
};
|
||||
|
||||
|
|
|
@ -213,8 +213,8 @@ void System::draw_entities(DinkyECS::World &world, Map &map, const Matrix &light
|
|||
const TileCell& cell = tiles.at(pos.location.x, pos.location.y);
|
||||
|
||||
// the 2 and 4 are from ftxui::Canvas since it does a kind of "subpixel" drawing
|
||||
canvas.DrawText(loc.x*2, loc.y*4, tile.chr, [light_value, cell](auto &pixel) {
|
||||
pixel.foreground_color = Color::HSV(255, 200, 180 * light_value);
|
||||
canvas.DrawText(loc.x*2, loc.y*4, tile.chr, [tile, light_value, cell](auto &pixel) {
|
||||
pixel.foreground_color = Color::HSV(tile.fg_h, tile.fg_s, tile.fg_v * light_value);
|
||||
pixel.background_color = Color::HSV(cell.bg_h, cell.bg_s, cell.bg_v * light_value);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue