From 273abc7c37e9bcdb7cf8d092ed356de01b906146 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Wed, 25 Apr 2018 12:44:03 +0200 Subject: Improve unit says a bit. --- src/game/unit_builder.cpp | 2 ++ src/game/units.cpp | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/game/unit_builder.cpp b/src/game/unit_builder.cpp index 1ed7f58..d35a1fc 100644 --- a/src/game/unit_builder.cpp +++ b/src/game/unit_builder.cpp @@ -121,6 +121,8 @@ void unit_builder_t::command_build(v2f_t where, type_t what) repairing = true; building = true; repairing_at = where; + + say("Rozpoczynam budowę."); } void unit_builder_t::repair(void) 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 && -- cgit