Played with UI layouts but keeping this for now. Fixed up config so it has keys() and now we load a boss per level.
This commit is contained in:
parent
281a7f687a
commit
5c815cf755
6 changed files with 35 additions and 8 deletions
|
@ -7,7 +7,15 @@
|
||||||
"weapon_sound": "Sword_Hit_2"
|
"weapon_sound": "Sword_Hit_2"
|
||||||
},
|
},
|
||||||
{"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false},
|
{"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false},
|
||||||
{"_type": "Animation", "easing": 3, "ease_rate": 0.2, "simple": false, "frames": 2, "speed": 0.02, "scale": 0.2},
|
{"_type": "Animation",
|
||||||
|
"easing": 3,
|
||||||
|
"ease_rate": 0.2,
|
||||||
|
"simple": false,
|
||||||
|
"frames": 2,
|
||||||
|
"speed": 0.02,
|
||||||
|
"scale": 0.2,
|
||||||
|
"stationary": false
|
||||||
|
},
|
||||||
{"_type": "Sprite", "name": "rat_king_boss", "width": 720, "height": 720, "scale": 0.8, "stationary": false},
|
{"_type": "Sprite", "name": "rat_king_boss", "width": 720, "height": 720, "scale": 0.8, "stationary": false},
|
||||||
{"_type": "Sound", "attack": "Marmot_Scream_1", "death": "Creature_Death_1"}
|
{"_type": "Sound", "attack": "Marmot_Scream_1", "death": "Creature_Death_1"}
|
||||||
]
|
]
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace gui {
|
||||||
CombatUI::CombatUI(GameLevel level) :
|
CombatUI::CombatUI(GameLevel level) :
|
||||||
$level(level)
|
$level(level)
|
||||||
{
|
{
|
||||||
$gui.position(RAY_VIEW_X, RAY_VIEW_HEIGHT, RAY_VIEW_WIDTH, SCREEN_HEIGHT - RAY_VIEW_HEIGHT);
|
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
|
||||||
$gui.layout(
|
$gui.layout(
|
||||||
"[*%(100,150)button_attack1 | *%(100,150)button_attack2 | *%(100,150)button_attack3 | *%(100,150)button_heal]"
|
"[*%(100,150)button_attack1 | *%(100,150)button_attack2 | *%(100,150)button_attack3 | *%(100,150)button_heal]"
|
||||||
"[ >.%(100,50)label_hp | *%.(198,50)bar_hp | _ ]");
|
"[ >.%(100,50)label_hp | *%.(198,50)bar_hp | _ ]");
|
||||||
|
|
10
config.cpp
10
config.cpp
|
@ -30,3 +30,13 @@ std::wstring Config::wstring(const std::string main_key, const std::string sub_k
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
|
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
|
||||||
return $converter.from_bytes(str_val);
|
return $converter.from_bytes(str_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> Config::keys() {
|
||||||
|
std::vector<std::string> the_fucking_keys;
|
||||||
|
|
||||||
|
for(auto& [key, value] : $config.items()) {
|
||||||
|
the_fucking_keys.push_back(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return the_fucking_keys;
|
||||||
|
}
|
||||||
|
|
|
@ -16,4 +16,5 @@ struct Config {
|
||||||
nlohmann::json &json() { return $config; };
|
nlohmann::json &json() { return $config; };
|
||||||
std::wstring wstring(const std::string main_key);
|
std::wstring wstring(const std::string main_key);
|
||||||
std::wstring wstring(const std::string main_key, const std::string sub_key);
|
std::wstring wstring(const std::string main_key, const std::string sub_key);
|
||||||
|
std::vector<std::string> keys();
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,15 +52,18 @@ constexpr int BASE_MAP_FONT_SIZE=80;
|
||||||
constexpr int GAME_MAP_PIXEL_POS = 600;
|
constexpr int GAME_MAP_PIXEL_POS = 600;
|
||||||
constexpr int MAX_FONT_SIZE = 140;
|
constexpr int MAX_FONT_SIZE = 140;
|
||||||
constexpr int MIN_FONT_SIZE = 20;
|
constexpr int MIN_FONT_SIZE = 20;
|
||||||
constexpr int STATUS_UI_WIDTH = SCREEN_WIDTH - RAY_VIEW_WIDTH;
|
|
||||||
constexpr int STATUS_UI_HEIGHT = SCREEN_HEIGHT;
|
constexpr float PERCENT = 0.01f;
|
||||||
|
|
||||||
constexpr int STATUS_UI_X = 0;
|
constexpr int STATUS_UI_X = 0;
|
||||||
constexpr int STATUS_UI_Y = 0;
|
constexpr int STATUS_UI_Y = 0;
|
||||||
constexpr float PERCENT = 0.01f;
|
constexpr int STATUS_UI_WIDTH = SCREEN_WIDTH - RAY_VIEW_WIDTH;
|
||||||
constexpr int COMBAT_UI_WIDTH = 89;
|
constexpr int STATUS_UI_HEIGHT = SCREEN_HEIGHT;
|
||||||
constexpr int COMBAT_UI_HEIGHT = 6;
|
|
||||||
constexpr int COMBAT_UI_X = RAY_VIEW_X;
|
constexpr int COMBAT_UI_X = RAY_VIEW_X;
|
||||||
constexpr int COMBAT_UI_Y = RAY_VIEW_HEIGHT;
|
constexpr int COMBAT_UI_Y = RAY_VIEW_HEIGHT;
|
||||||
|
constexpr int COMBAT_UI_WIDTH = RAY_VIEW_WIDTH ;
|
||||||
|
constexpr int COMBAT_UI_HEIGHT = SCREEN_HEIGHT - RAY_VIEW_HEIGHT;
|
||||||
|
|
||||||
|
|
||||||
// for the panels/renderer
|
// for the panels/renderer
|
||||||
|
|
|
@ -39,7 +39,12 @@ shared_ptr<gui::BossFightUI> LevelManager::create_bossfight(shared_ptr<DinkyECS:
|
||||||
dbc::check(prev_world != nullptr, "Starter world for boss fights can't be null.");
|
dbc::check(prev_world != nullptr, "Starter world for boss fights can't be null.");
|
||||||
auto world = clone_load_world(prev_world);
|
auto world = clone_load_world(prev_world);
|
||||||
auto& config = prev_world->get_the<GameConfig>();
|
auto& config = prev_world->get_the<GameConfig>();
|
||||||
auto& boss_data = config.bosses["DEVILS_FINGERS"];
|
|
||||||
|
// BUG: the jank is too strong here
|
||||||
|
auto boss_names = config.bosses.keys();
|
||||||
|
auto& level_name = boss_names[$current_level % boss_names.size()];
|
||||||
|
auto& boss_data = config.bosses[level_name];
|
||||||
|
|
||||||
auto boss_id = world->entity();
|
auto boss_id = world->entity();
|
||||||
components::configure_entity($components, *world, boss_id, boss_data["components"]);
|
components::configure_entity($components, *world, boss_id, boss_data["components"]);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue