diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-13 12:17:34 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-13 12:17:34 +0200 |
commit | 2cada8d93653324cb90fc81d4eb670bab9af089a (patch) | |
tree | fd964a42030d95eecf720b710f1a3ae8c81ef876 /src/game/effects.cpp | |
parent | 7159afab99b130e7f3c5560765dded6c861f6c3b (diff) |
Better explosion graphics.
Diffstat (limited to 'src/game/effects.cpp')
-rw-r--r-- | src/game/effects.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/game/effects.cpp b/src/game/effects.cpp index 6f92f17..da045ef 100644 --- a/src/game/effects.cpp +++ b/src/game/effects.cpp @@ -63,12 +63,13 @@ void fx_tracer_t::render_to(render::state_t *render) } -fx_flash_t::fx_flash_t(state_t *game_, v2f_t x_, float radius_) : effect_t(game_) +fx_flash_t::fx_flash_t(state_t *game_, v2f_t x_, float radius_, sf::Color color_) : effect_t(game_) { ttl = game->now + 0.07; x = x_; radius = radius_; + color = color_; render_bounds[0] = x - v2f_t(radius, radius); render_bounds[1] = x + v2f_t(radius, radius); @@ -83,7 +84,7 @@ fx_flash_t::fx_flash_t(state_t *game_, v2f_t x_, float radius_) : effect_t(game_ void fx_flash_t::render_to(render::state_t *render) { - render->render(0.0f, &assets::fx.flash, render_bounds, sf::Color(255, 170, 50, 80)); + render->render(0.0f, &assets::fx.flash, render_bounds, color); } fx_blood_t::fx_blood_t(state_t *game_, v2f_t x_, bool alien_) : effect_t(game_) @@ -154,7 +155,9 @@ void fx_aim_marker_t::render_to(render::state_t *render) fx_explosion_t::fx_explosion_t(state_t *game_, v2f_t x_) : effect_t(game_) { - ttl = game->now + 1.3; + fx_flash_t *flash; + + ttl = game->now + 0.8; x = x_; @@ -168,11 +171,14 @@ fx_explosion_t::fx_explosion_t(state_t *game_, v2f_t x_) : effect_t(game_) wake(); assets::fx.explosion_sound.play_3d(x); + + flash = new fx_flash_t(game, x, 5.0f, sf::Color(255, 255, 170, 255)); + flash->place(&game->world); } void fx_explosion_t::render_to(render::state_t *render) { - double phase = (game->now - ttl) / 1.3f; + double phase = (game->now - ttl) / 0.8f; render->render(phase, &assets::fx.explosion, render_bounds, sf::Color::White); } |