STEP 18 OF 67 · YOU ARE THE GAMEPLAY PROGRAMMER
Make one combat interaction work
Attack input, timing, hit detection, damage and recovery. The animation is only the picture; code decides when the hit lands and what it does.
How to do it
- Press attack, play the swing, check for a hit during the active frames only.
- Apply damage, then a short recovery before the next attack.
- Test it on a simple target dummy.
How AI speeds this up
Ask Duke to write the hit-detection code from your rules and explain the timing.
Example from a sample game
Ashfall: sword hit window frames 8-14, 25 damage, 0.4 s recovery.
Before you move on
In Duke Forger, this step's gate checks:
- You confirm itAn attack hits only during its active frames
- You confirm itDamage and recovery follow your step 5 rules
Words to know
- Hit detection
- The code that decides whether an attack actually touched its target.
- Hitbox
- An invisible shape used to detect hits.
Do step 18 on your own game
Start freeIncluded in Creator, Academy and Studio. Duke drafts it with you and checks it before step 19 opens.