Now have animated torches that are defined from json, and smoother animations in the arena.
This commit is contained in:
parent
387d1a5bf5
commit
7c11ffa2af
10 changed files with 111 additions and 73 deletions
|
|
@ -38,12 +38,12 @@ namespace components {
|
|||
float tick = twitching();
|
||||
|
||||
if(stationary) {
|
||||
scale_out.x = std::lerp(scale, max_scale, tick);
|
||||
scale_out.y = std::lerp(scale, max_scale, tick);
|
||||
scale_out.x = std::lerp(scale_x, max_scale, tick);
|
||||
scale_out.y = std::lerp(scale_y, max_scale, tick);
|
||||
pos_out.y = pos_out.y - (pos_out.y * scale_out.y - pos_out.y);
|
||||
} else {
|
||||
scale_out.x = std::lerp(scale_out.x * scale, scale_out.x * max_scale, tick);
|
||||
scale_out.y = std::lerp(scale_out.y * scale, scale_out.y * max_scale, tick);
|
||||
scale_out.x = std::lerp(scale_out.x * scale_x, scale_out.x * max_scale, tick);
|
||||
scale_out.y = std::lerp(scale_out.y * scale_y, scale_out.y * max_scale, tick);
|
||||
}
|
||||
|
||||
if(!simple) {
|
||||
|
|
@ -51,8 +51,8 @@ namespace components {
|
|||
}
|
||||
|
||||
subframe += speed;
|
||||
current = int(subframe);
|
||||
} else if(!looped) {
|
||||
current = looped ? int(subframe) % frames : int(subframe);
|
||||
} else if(toggled) {
|
||||
playing = false;
|
||||
current = frames - 1;
|
||||
subframe = float(frames - 1);
|
||||
|
|
@ -61,8 +61,8 @@ namespace components {
|
|||
rect_out.position.x += current * frame_width;
|
||||
}
|
||||
} else {
|
||||
scale_out.x = scale;
|
||||
scale_out.y = scale;
|
||||
scale_out.x = scale_x;
|
||||
scale_out.y = scale_y;
|
||||
playing = false;
|
||||
current = 0;
|
||||
subframe = 0.0f;
|
||||
|
|
@ -80,7 +80,7 @@ namespace animation {
|
|||
|
||||
bool apply(Animation& anim, sf::Sprite& sprite, sf::Vector2f pos) {
|
||||
sf::IntRect rect{{0,0}, {anim.frame_width, anim.frame_height}};
|
||||
sf::Vector2f scale{anim.scale, anim.scale};
|
||||
sf::Vector2f scale{anim.scale_x, anim.scale_y};
|
||||
|
||||
anim.step(scale, pos, rect);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue