gdquest-demos / godot-3-demos

Dozens of free and open source demos for the Godot game engine, version 3. Head to the link below for newer demos for Godot 4+
https://github.com/gdquest-demos/
MIT License
1.85k stars 978 forks source link

Slight typo in `heal` for Finite State Machine #71

Closed WolfgangSenff closed 3 years ago

WolfgangSenff commented 3 years ago

I'm submitting a bug report

Bug report

What is the current behavior? When you heal beyond the current max health, it chooses the value above the max health. Further, if you heal once but it isn't enough to fully heal you, it currently would still fully heal you regardless.

What is the expected behavior? The variable name max_health implies it is a value that cannot be exceeded, so it should be choosing the minimum of the current and max health values.

Tell us the steps to reproduce the bug, and if possible share a minimal demo of the problem.

  1. Open FSM project
  2. Code it so you only heal a single hit point when healing, take nearly-fatal damage
  3. Heal - notice it chooses max_health because it's the max of the current health and the max.

I'll be opening a PR to fix this shortly.