A risk-reward heal costs you twice: you earn the energy by landing hits, then spend 0.9 s standing still to use it, and any hit cancels it. It turns healing from a panic button into a question you ask mid-fight: do I have a second right now?
- can be cut (900 ms): the mask, Lost: the hit cuts the heal n ms in. the energy, Kept: it's only spent when the heal finishes.
Risk-reward healing: pay with hits, then with time
Every hit that connects gives 11 energy, and a whiff or a hit blocked by a shield gives nothing. One mask costs 33, so three hits buy a heal: then you hold V for 0.9 s, on the ground and unable to move. The loop regulates difficulty on its own, because whoever plays well gets more heals.
You're in control from the first frame. The steps are below.
- Hit the training dummy with C. Every hit that connects adds 11 energy; three hits are enough for one heal.
- At full health the heal won't start. Step on the damage plate to lose a mask.
- Stand still on the ground and hold V for 0.9 s. You can't move while it charges.
- Now go to the hopper's pen and try it there. If it lands on you, the heal is cut and the energy stays.
On a phone you get on-screen buttons: ← → to move, JUMP, and T for the technique.
The real game, running in your browser. The first load fetches the engine; after that it is cached.
Hollow Knight's Focus runs on almost the same numbers: a meter of 99, 11 SOUL per hit and 33 per mask (SOUL and Focus on the community wiki).
How to implement a risk-reward heal
- Add energy where a hit is resolved, and only when it connects: the same moment as the hit confirm.
- Make the heal a timer that only runs while the button is held and the player is on the floor, with movement switched off.
- Spend the energy when the timer completes, not when it starts. You only pay for a heal you actually got.
- After a hit, require letting go and pressing again. Otherwise a held button restarts the heal as soon as the knockback ends, with the enemy still on top of you.
The code in Godot 4
@export_range(0, 99) var energy_per_hit := 11
@export_range(1, 99) var heal_cost := 33
@export_range(0.1, 3.0, 0.05, "suffix:s") var heal_time := 0.9 func _tick_heal(delta: float) -> void:
# ...
player.control_enabled = false # quieto: ése es el riesgo
heal_started.emit()
return
if not holding or not player.is_on_floor():
_stop_heal(true)
return
_heal_time += delta
# ...
if _heal_time >= params.heal_time:
add_energy(-params.heal_cost)
var amount := health.heal(params.heal_amount)
healed.emit(amount)
func _on_damaged(hit: Hit) -> void:
# ...
_stop_heal(true)
_heal_blocked = true add_energy(-params.heal_cost) only runs once the timer completes, so a heal cut short costs time, not energy.
Quick answers
How do you make healing risky in a game?
Make it take time, take away movement while it runs and let any hit cancel it. Here that's 0.9 s on the ground with no control.
How long should a heal take?
Around a second. This one takes 0.9 s per mask; Hollow Knight's Focus takes about 1.14 s for the first and 0.89 s for each after. Much shorter and there is no risk; much longer and nobody tries it outside an empty room.
Should an interrupted heal still cost resources?
Pick one on purpose. Hollow Knight wastes the SOUL consumed, while here the energy is only spent when the heal completes. Charging at the end makes players try more often.
Discussion
Comments are hosted on GitHub Discussions — sign in with GitHub to reply.