New boss scene that's really just a pixelated photo bash done quickly.

This commit is contained in:
Zed A. Shaw 2025-10-12 14:05:30 -04:00
parent ca38b58450
commit 7f10c5b3d7
10 changed files with 37 additions and 29 deletions

View file

@ -121,9 +121,9 @@
},
"rat_king_boss": {
"_type": "Animation",
"easing": 1,
"ease_rate": 0.5,
"scale": 0.4,
"easing": 4,
"ease_rate": 0.9,
"scale": 0.8,
"simple": false,
"frames": 2,
"speed": 0.02,

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View file

@ -2,8 +2,8 @@
"RAT_KING": {
"components": [
{"_type": "BossFight",
"background": "boss_fight_background",
"floor": "devils_fingers_background",
"background": "test_background",
"floor": false,
"floor_pos": "floor1",
"player": {
"sprite": "peasant_girl_rear_view",
@ -12,13 +12,13 @@
"mid_cell": false
},
"boss": {
"start_pos": "boss2",
"scale": 0.7,
"start_pos": "boss5",
"scale": 0.6,
"mid_cell": true
}
},
{"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": 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": true},
{"_type": "Sound", "attack": "Marmot_Scream_1", "death": "Creature_Death_1"}
]
}

View file

@ -246,9 +246,9 @@
"frame_height": 540
},
"test_background":
{"path": "assets/bossfights/test_background.png",
"frame_width": 1920,
"frame_height": 1080
{"path": "assets/boss2/boss_fight_scene_1_wall.png",
"frame_width": 1080,
"frame_height": 720
},
"test_boss":
{"path": "assets/bossfights/test_boss.png",
@ -256,9 +256,9 @@
"frame_height": 832
},
"test_floor":
{"path": "assets/bossfights/test_floor.png",
"frame_width": 1920,
"frame_height": 1080
{"path": "assets/boss2/boss_fight_scene_1_floor.png",
"frame_width": 1080,
"frame_height": 720
},
"test_player":
{"path": "assets/bossfights/test_player.png",

View file

@ -358,7 +358,6 @@ bool Autowalker::player_health_good() {
auto player = GameDB::the_player();
auto combat = world->get<components::Combat>(player);
float health = float(combat.hp) / float(combat.max_hp);
fmt::println("!!!!!!!!!! HEALTH: {}", health);
return health > 0.5f;
}

View file

@ -105,7 +105,7 @@ namespace boss {
break;
case ATTACK: {
$ui.status(L"BOSS TURN");
$ui.move_boss(run % 10 < 5 ? "boss1" : "boss2");
$ui.move_boss(run % 10 < 5 ? "boss5" : "boss6");
$ui.$boss_anim.play();
int attack_id = std::any_cast<int>(data);
boss::System::combat(attack_id);
@ -128,7 +128,7 @@ namespace boss {
}
void Fight::render(sf::RenderWindow& window) {
$ui.render(window);
$ui.play_animations(window);
$ui.render(window);
}
}

View file

@ -31,7 +31,7 @@ namespace boss {
void UI::init() {
$arena.position(SCREEN_WIDTH-BOSS_VIEW_WIDTH,0, BOSS_VIEW_WIDTH, SCREEN_HEIGHT);
$arena.set<Background>($arena.MAIN, {$arena.$parser, THEME.DARK_MID});
$arena.set<Background>($arena.MAIN, {$arena.$parser, THEME.TRANSPARENT});
auto& background = $arena.get<Background>($arena.MAIN);
background.set_sprite($scene.background, true);
@ -82,14 +82,16 @@ namespace boss {
}
void UI::render(sf::RenderWindow& window) {
$actions.render(window);
$combat_ui.render(window);
$arena.render(window);
if($floor_sprite.sprite) {
window.draw(*$floor_sprite.sprite);
}
$arena.render(window);
window.draw(*$boss_sprite.sprite);
window.draw(*$player_sprite.sprite);
@ -118,19 +120,25 @@ namespace boss {
}
void UI::play_animations(sf::RenderWindow& window) {
using namespace std::chrono_literals;
auto& sound = $world->get<components::Sound>($boss_id);
if($boss_anim.playing) {
using namespace std::chrono_literals;
auto& sound = $world->get<components::Sound>($boss_id);
while($boss_anim.playing) {
animation::apply($boss_anim, *$boss_sprite.sprite, $boss_pos);
if($boss_anim.current == 1 && !sound::playing(sound.attack)) {
sound::play(sound.attack);
}
// https://www.construct.net/en/blogs/ashleys-blog-2/using-lerp-delta-time-924
// frame start
render(window);
window.display();
std::this_thread::sleep_for(16ms);
// frame end
// deltaTime = end - start
// lerp(a, b, 1 - f ^ deltaTime)
// std::this_thread::sleep_for(16ms);
}
}
}

View file

@ -29,10 +29,11 @@ function Build-Images {
# Build-Images -Source "Sprites" -pixel_count 6
# Build-Images -Source "Items" -pixel_count 2
# Build-Images -Source "Animations" -pixel_count 6
Build-Images -Source "Hands" -pixel_count 6
# Build-Images -Source "Hands" -pixel_count 6
Build-Images -Source "Boss2" -pixel_count 4
magick montage -tile 3x1 -geometry +0+0 -background transparent .\assets\hands\female_hand_*.png .\assets\hands\female_hand.png
#magick montage -tile 3x1 -geometry +0+0 -background transparent .\assets\hands\female_hand_*.png .\assets\hands\female_hand.png
magick montage -tile 3x1 -geometry +0+0 -background transparent .\assets\hands\male_hand_*.png .\assets\hands\male_hand.png
#magick montage -tile 3x1 -geometry +0+0 -background transparent .\assets\hands\male_hand_*.png .\assets\hands\male_hand.png
cp -recurse -force C:\Users\lcthw\Pictures\Games\Renders\Raycaster\UI assets\ui
#cp -recurse -force C:\Users\lcthw\Pictures\Games\Renders\Raycaster\UI assets\ui

View file

@ -38,7 +38,7 @@ TEST_CASE("make sure json_mods works", "[components]") {
if(comp_data["_type"] == "BossFight") {
auto comp = components::convert<components::BossFight>(comp_data);
// the boss fight for the rat king doesn't have a stage so false=optional
REQUIRE(comp.floor != std::nullopt);
REQUIRE(comp.floor == std::nullopt);
}
}
@ -51,5 +51,5 @@ TEST_CASE("make sure json_mods works", "[components]") {
components::configure_entity(world, rat_king, config["RAT_KING"]["components"]);
auto boss = world.get<BossFight>(rat_king);
REQUIRE(boss.floor != std::nullopt);
REQUIRE(boss.floor == std::nullopt);
}