diff --git a/assets/animations.json b/assets/animations.json index 5cdbc6e..97d922b 100644 --- a/assets/animations.json +++ b/assets/animations.json @@ -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, diff --git a/assets/boss2/boss_fight_scene_1_floor.png b/assets/boss2/boss_fight_scene_1_floor.png new file mode 100644 index 0000000..180007b Binary files /dev/null and b/assets/boss2/boss_fight_scene_1_floor.png differ diff --git a/assets/boss2/boss_fight_scene_1_wall.png b/assets/boss2/boss_fight_scene_1_wall.png new file mode 100644 index 0000000..ddb95f2 Binary files /dev/null and b/assets/boss2/boss_fight_scene_1_wall.png differ diff --git a/assets/bosses.json b/assets/bosses.json index c6f8ff0..bdfe8ac 100644 --- a/assets/bosses.json +++ b/assets/bosses.json @@ -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"} ] } diff --git a/assets/config.json b/assets/config.json index 65e5afe..ac70ced 100644 --- a/assets/config.json +++ b/assets/config.json @@ -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", diff --git a/autowalker.cpp b/autowalker.cpp index 5cb33e5..bcb4458 100644 --- a/autowalker.cpp +++ b/autowalker.cpp @@ -358,7 +358,6 @@ bool Autowalker::player_health_good() { auto player = GameDB::the_player(); auto combat = world->get(player); float health = float(combat.hp) / float(combat.max_hp); - fmt::println("!!!!!!!!!! HEALTH: {}", health); return health > 0.5f; } diff --git a/boss/fight.cpp b/boss/fight.cpp index 26c7047..9ca5743 100644 --- a/boss/fight.cpp +++ b/boss/fight.cpp @@ -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(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); } } diff --git a/boss/ui.cpp b/boss/ui.cpp index 39f5f59..31567bb 100644 --- a/boss/ui.cpp +++ b/boss/ui.cpp @@ -31,7 +31,7 @@ namespace boss { void UI::init() { $arena.position(SCREEN_WIDTH-BOSS_VIEW_WIDTH,0, BOSS_VIEW_WIDTH, SCREEN_HEIGHT); - $arena.set($arena.MAIN, {$arena.$parser, THEME.DARK_MID}); + $arena.set($arena.MAIN, {$arena.$parser, THEME.TRANSPARENT}); auto& background = $arena.get($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($boss_id); + if($boss_anim.playing) { + using namespace std::chrono_literals; + auto& sound = $world->get($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); } } } diff --git a/scripts/build_assets.ps1 b/scripts/build_assets.ps1 index 8d18649..66d7009 100644 --- a/scripts/build_assets.ps1 +++ b/scripts/build_assets.ps1 @@ -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 diff --git a/tests/components.cpp b/tests/components.cpp index ff8e43a..ae54016 100644 --- a/tests/components.cpp +++ b/tests/components.cpp @@ -38,7 +38,7 @@ TEST_CASE("make sure json_mods works", "[components]") { if(comp_data["_type"] == "BossFight") { auto comp = components::convert(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(rat_king); - REQUIRE(boss.floor != std::nullopt); + REQUIRE(boss.floor == std::nullopt); }