Animations now can have a stationary option which tries to keep them 'in place' while growing, effectively removing the forward motion.

This commit is contained in:
Zed A. Shaw 2025-03-04 12:12:27 -05:00
parent eb8fb82837
commit 8b414c13e6
8 changed files with 36 additions and 15 deletions

View file

@ -112,16 +112,17 @@ namespace components {
bool simple = true;
int frames = 10;
float speed = 0.3f;
ease::Style easing = ease::IN_OUT_BACK;
float ease_rate = 0.5f;
bool stationary = false;
int current = 0;
bool playing = false;
float subframe = 0;
ease::Style easing = ease::IN_OUT_BACK;
float ease_rate = 0.5f;
int texture_width = TEXTURE_WIDTH;
void play();
float twitching();
void step(sf::Vector2f& scale_out, sf::IntRect& rect_out);
void step(sf::Vector2f& scale_out, sf::Vector2f& pos_out, sf::IntRect& rect_out);
};
template <typename T> struct NameOf;
@ -138,7 +139,8 @@ namespace components {
ENROLL_COMPONENT(Motion, dx, dy, random);
ENROLL_COMPONENT(Combat, hp, max_hp, damage, dead);
ENROLL_COMPONENT(Device, config, events);
ENROLL_COMPONENT(Animation, scale, simple, frames, speed, easing, ease_rate);
ENROLL_COMPONENT(Animation, scale, simple, frames,
speed, easing, ease_rate, stationary);
ENROLL_COMPONENT(Sound, attack, death);
using ReflFuncSignature = std::function<void(DinkyECS::World& world, DinkyECS::Entity ent, nlohmann::json &j)>;