Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let squished enemies fade out instead of vanishing instantly #3198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Brockengespenst
Copy link
Contributor

Squished enemies will now fadeout instead of vanishing instantly. This looks a bit smoother and is more aligned with the melting or burning animation.

Squished enemies will now fadeout instead of vanishing instantly. This
looks a bit smoother and is more aligned with the melting or burning
animation.
@Brockengespenst
Copy link
Contributor Author

Brockengespenst commented Feb 2, 2025

Just an idea. Looks better to me when squished Badguys do not vanish instantly. If you do not like it, I can delete this PR.

@bruhmoent
Copy link
Member

Could you please provide video footage?

@Brockengespenst
Copy link
Contributor Author

@tobbi
Copy link
Member

tobbi commented Feb 3, 2025

Looking good to me.

@tobbi tobbi requested review from MatusGuy and Vankata453 February 8, 2025 16:09
@@ -315,12 +317,18 @@ BadGuy::update(float dt_sec)
case STATE_SQUISHED:
m_is_active_flag = false;
if (m_state_timer.check()) {
remove_me();
m_alpha_before_fadeout = m_sprite->get_alpha();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An enemy at 0.5 alpha should fade out faster. In that case, you don't need this variable. You can multiply the fadeout time by the alpha in the set_state function.

if (m_state_timer.check())
remove_me();
else
m_sprite->set_alpha(m_alpha_before_fadeout - (m_alpha_before_fadeout * m_state_timer.get_progress()));
Copy link
Member

@MatusGuy MatusGuy Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here you'd only need to put m_state_timer.get_progress()

Suggested change
m_sprite->set_alpha(m_alpha_before_fadeout - (m_alpha_before_fadeout * m_state_timer.get_progress()));
m_sprite->set_alpha(1.f - m_state_timer.get_progress()));

@@ -760,6 +768,9 @@ BadGuy::set_state(State state_)
case STATE_SQUISHED:
m_state_timer.start(SQUISH_TIME);
break;
case STATE_SQUISHED_FADING_OUT:
m_state_timer.start(FADEOUT_TIME);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
m_state_timer.start(FADEOUT_TIME);
m_state_timer.start(FADEOUT_TIME * m_sprite.get_alpha());

@@ -42,6 +42,7 @@
static const float SQUISH_TIME = 2;
static const float GEAR_TIME = 2;
static const float BURN_TIME = 1;
static const float FADEOUT_TIME = 0.2f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure because I havent tested this in game but this might be too fast?? Someone else needs to confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants