Played with UI layouts but keeping this for now. Fixed up config so it has keys() and now we load a boss per level.

master
Zed A. Shaw 4 days ago
parent 281a7f687a
commit 5c815cf755
  1. 10
      assets/bosses.json
  2. 2
      combat_ui.cpp
  3. 10
      config.cpp
  4. 1
      config.hpp
  5. 13
      constants.hpp
  6. 7
      levelmanager.cpp

@ -7,7 +7,15 @@
"weapon_sound": "Sword_Hit_2"
},
{"_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": "Sound", "attack": "Marmot_Scream_1", "death": "Creature_Death_1"}
]

@ -9,7 +9,7 @@ namespace gui {
CombatUI::CombatUI(GameLevel 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(
"[*%(100,150)button_attack1 | *%(100,150)button_attack2 | *%(100,150)button_attack3 | *%(100,150)button_heal]"
"[ >.%(100,50)label_hp | *%.(198,50)bar_hp | _ ]");

@ -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;
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; };
std::wstring wstring(const std::string main_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 MAX_FONT_SIZE = 140;
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_Y = 0;
constexpr float PERCENT = 0.01f;
constexpr int COMBAT_UI_WIDTH = 89;
constexpr int COMBAT_UI_HEIGHT = 6;
constexpr int STATUS_UI_WIDTH = SCREEN_WIDTH - RAY_VIEW_WIDTH;
constexpr int STATUS_UI_HEIGHT = SCREEN_HEIGHT;
constexpr int COMBAT_UI_X = RAY_VIEW_X;
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

@ -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.");
auto world = clone_load_world(prev_world);
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();
components::configure_entity($components, *world, boss_id, boss_data["components"]);

Loading…
Cancel
Save