A boss fight is an exam: it teaches nothing new and combines what the player already learned. This one has three attacks with their own warnings, collapses for 2.2 s after seven hits, and speeds up at half health.
| Boss attack | Warning | Asked before by |
|---|---|---|
| Charge | 0.6 s | The charger |
| Hammer | 0.5 s | The hopper |
| Burst | 0.6 s | The drone |
Boss attacks: questions the player already answered
Each attack repeats an earlier enemy's question and takes the same answer. After every attack the boss recovers for 0.8 s: your turn to hit it.
You're in control from the first frame. The steps are below.
- Walk right with → into the room. The gates close behind you and the boss wakes up.
- Read each warning. Charge: jump with Space or dash through with X. Hammer: get out from under it, then jump the two shockwaves. Burst: keep moving or dash through the fan.
- Hit it with C while it recovers after each attack. Seven hits and it collapses for 2.2 s: that's your big opening.
- At half health it roars and everything gets faster. If you lose, you're back at the door with full health.
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.
Random boss attacks, with rules
A fixed order gets memorized instead of read. So the pick is weighted by distance and never the same attack three times in a row: within 260 px the hammer comes half the time, further away a quarter. You can't predict the next attack, but you can predict the mood.
Stagger bar: aggression turned into an opening
The boss never flinches from a single hit, so the stagger bar is where your aggression shows: the seventh hit drops it for 2.2 s with its contact damage off. Sekiro builds its whole combat on the same idea, posture.
Boss phases: the same attacks, faster
At half health the boss roars for 0.9 s, so you notice the rules just changed. Then warnings are multiplied by 0.85 and recoveries by 0.72, with no new attacks to learn mid-fight.
How to implement a boss fight
- Build the boss on the regular enemy loop, and add only an attack selector and a hit counter.
- Weight each pick by distance, and drop the last attack from the pool once it has come twice in a row.
- Ignore hits during the stagger so collapses can't chain, and if the bar fills mid-jump or mid-charge, collapse when the attack ends, not in mid-air.
- Put the checkpoint at the door, and close the gates only once the player is inside and clear of both.
The code in Godot 4
func _choose_attack() -> void:
var far := absf(to_target().x) > 260.0
var weights := {
&"embestida": 3.0 if far else 2.0,
&"martillo": 2.0 if far else 3.0,
&"rafaga": 3.0 if far else 1.0,
}
if _repeats >= 1:
weights.erase(_last_attack) # como mucho dos veces seguidas
func _on_damaged(hit: Hit) -> void:
super(hit)
if state == &"staggered":
return # ya está desplomado: los golpes no alargan la apertura
# AGUANTE: cada golpe suma; al llenarse, se desploma.
poise_damage += 1
if poise_damage >= poise:
if state in [&"idle", &"recover", &"windup", &"burst", &"roar"]:
_stagger()
else:
_stagger_pending = true # en pleno salto o embestida: al terminar embestida is the charge, martillo the hammer and rafaga the burst; the weighted draw comes right after, in the same function.
Quick answers
How many attacks should a boss have?
Few enough to learn in a handful of attempts. This one has three, and its script says why: better three that read well than ten that confuse.
How do you make boss attack patterns random but fair?
Put rules on the randomness: weight the choice by distance, never repeat an attack three times in a row, and keep every warning. The order can't be memorized, but the next move can always be read.
This is the last post in the series: one room where every earlier technique has to work at once.
Discussion
Comments are hosted on GitHub Discussions — sign in with GitHub to reply.