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:
parent
eb8fb82837
commit
8b414c13e6
8 changed files with 36 additions and 15 deletions
|
@ -54,12 +54,16 @@ namespace components {
|
|||
}
|
||||
}
|
||||
|
||||
void Animation::step(sf::Vector2f& scale_out, sf::IntRect& rect_out) {
|
||||
void Animation::step(sf::Vector2f& scale_out, sf::Vector2f& pos_out, sf::IntRect& rect_out) {
|
||||
if(playing && current < frames) {
|
||||
float tick = twitching();
|
||||
scale_out.x = std::lerp(scale_out.x, scale_out.x + scale, tick);
|
||||
scale_out.y = std::lerp(scale_out.y, scale_out.y + scale, tick);
|
||||
|
||||
if(stationary) {
|
||||
pos_out.y = pos_out.y - (pos_out.y * scale_out.y - pos_out.y);
|
||||
}
|
||||
|
||||
if(!simple) {
|
||||
rect_out.position.x += current * texture_width;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue