diff --git a/animation.cpp b/animation.cpp index 867908e..f0038ec 100644 --- a/animation.cpp +++ b/animation.cpp @@ -17,7 +17,7 @@ namespace components { case ease::NONE: return 0.0; case ease::SINE: - return tick; + return std::abs(std::sin(subframe * ease_rate)); case ease::OUT_CIRC: return ease::out_circ(tick); case ease::OUT_BOUNCE: @@ -41,6 +41,7 @@ namespace components { if(playing && current < frames) { float tick = twitching(); + fmt::print("tick: {}\r", tick); if(stationary) { switch(motion) { @@ -178,9 +179,9 @@ namespace animation { return MGR.animations.contains(name); } - Animation load(const std::string& name) { + Animation load(const std::string& name, const std::string& state) { dbc::check(initialized, "You forgot to initialize animation."); - return MGR.animations.at(name); + return MGR.animations.at(name + state); } void configure(DinkyECS::World& world, DinkyECS::Entity entity) { diff --git a/animation.hpp b/animation.hpp index f539870..f89496a 100644 --- a/animation.hpp +++ b/animation.hpp @@ -16,7 +16,7 @@ namespace animation { void center(sf::Sprite& target, sf::Vector2f pos); void init(); - components::Animation load(const std::string& name); + components::Animation load(const std::string& name, const std::string& state=""); bool has(const std::string& name); void configure(DinkyECS::World& world, DinkyECS::Entity entity); void step_animation(DinkyECS::World& world, DinkyECS::Entity entity, sf::Vector2f& scale_out, sf::Vector2f& pos_out, sf::IntRect& rect_out); diff --git a/assets/animations.json b/assets/animations.json index a58f480..da830fc 100644 --- a/assets/animations.json +++ b/assets/animations.json @@ -235,15 +235,33 @@ "flipped": false, "looped": false }, + "rat_king_boss": { + "_type": "Animation", + "easing": 4, + "motion": 0, + "ease_rate": 0.5, + "min_x": 0.6, + "min_y": 0.6, + "max_x": 0.8, + "max_y": 0.8, + "simple": false, + "frames": 2, + "speed": 0.02, + "scaled": true, + "stationary": true, + "toggled": false, + "flipped": false, + "looped": false + }, "torch_fixture": { "_type": "Animation", "easing": 0, "motion": 0, - "ease_rate": 0.5, - "min_x": 0.5, - "min_y": 0.5, - "max_x": 0.5, - "max_y": 0.5, + "ease_rate": 0.1, + "min_x": 0.6, + "min_y": 0.6, + "max_x": 0.6, + "max_y": 0.6, "simple": false, "frames": 3, "speed": 0.2,