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

Below the Surface - kill enemies that are at negative HP; fix Blob HP #211

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

MHLoppy
Copy link
Contributor

@MHLoppy MHLoppy commented May 16, 2024

Description

Issue 1: (the main one)

Currently enemies are only killed if they're jumped on and have exactly 0 HP (the game essentially 0-indexes HP by coding its HP check in this way). This leads to the possibility that enemies can be brought to less than 0 HP and then become functionally invulnerable.

The check has been changed from == 0 to <= 0, and some explanatory comments have been added since 0-indexing HP is extremely unusual.

Issue 2: (a minor side thing)

Most enemies spawn with 0 HP (essentially 1 HP because HP is functionally 0-indexed). However, the Blob enemy is explicitly noted in a comment as being intended to die with 3 jumps, but was set to 3 (and thus functionally 4) HP.

The Blob's HP has been changed to 2 (which is the functionally-3 it seems it was intended to have), and explanatory comments have been added since 0-indexing HP is extremely unusual.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation (update or new)

How Has This Been Tested?

After figuring out the logic used by the game for HP / enemy death calculations, I confirmed the logic using temporary debugging outputs and played for a few minutes to check the debugging outputs. I then verified my changes worked as expected (e.g., no more invulnerable enemies caused by attacking them before jumping on them*, and Blob dies in exactly 3 jumps) by playing a build with and without the changes applied.

* this also relates to changes made in #202

Testing Checklist

N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation (N/A)
  • My changes generate no new warnings
  • I'll mark my work as ready for peer review

@MHLoppy MHLoppy marked this pull request as ready for review May 16, 2024 17:32
@MHLoppy
Copy link
Contributor Author

MHLoppy commented May 16, 2024

@github-actions github-actions bot added the compiled the source code has been successfully compiled label May 16, 2024
@DerDieDasDeakin
Copy link
Contributor

Peer Review for Below the Surface enemy changes:
Nice work for this fix, I'm surprised it was originally set to be only equal to 0 instead of equal-to-or-less-than, so the implementation is definitely the best solution for this one. I'm happy with the small blob nerf too, especially since it seems like it was an oversight and is now more in-line with the original intentions. Overall, some small but needed changes that have a considerable impact on gameplay. This one is definitely ready for mentor review and is a needed merge. Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiled the source code has been successfully compiled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants