diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-25 12:44:03 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-25 12:44:03 +0200 |
commit | 273abc7c37e9bcdb7cf8d092ed356de01b906146 (patch) | |
tree | 748c0f589ce38bdba93b2fac615e62e04dcbe5ee /src/game/units.cpp | |
parent | 7fe865d745fede7e2628ecf0c91b38bb15154cb3 (diff) |
Improve unit says a bit.
Diffstat (limited to 'src/game/units.cpp')
-rw-r--r-- | src/game/units.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/game/units.cpp b/src/game/units.cpp index e9abda4..73ea43a 100644 --- a/src/game/units.cpp +++ b/src/game/units.cpp @@ -56,15 +56,21 @@ void unit_t::render_to(render::state_t *render) if (move.moving && debug_draw_paths) render->debug_path(x, &move.path); - if (!dead && say_time + 5.0 > game->now) { + if (!dead && say_time + 3.0 > game->now) { + float anim, height; v2f_t text_pos; - float height; + sf::Color color; + + anim = pow((game->now - say_time) / 3.0f, 5.0f); text_pos = render_bounds[0] + v2f_t(render_bounds.dim(0) / 2, -render_bounds.dim(1) * 0.1); height = size.dim_min() * 0.50f; + + text_pos[1] -= anim * height * 2.0f; + color = sf::Color(255, 255, 255, 255.0f * (1.0f - anim)); + render->render_text(text_pos, height, say_text, - render::ALIGN_CENTER_BOTTOM, - sf::Color::White); + render::ALIGN_CENTER_BOTTOM, color); } if (selected == selection_cookie && type != UNIT_SOLDIER && |