# Hitboxes

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

A [Hitbox 2D](/ref/gameplay.Hitbox2D.md) damages the hurtboxes inside its area after the physics step. Policy decides how often one target is hit:

| Policy | Hits |
|---|---|
| onEnter | every time the target enters |
| oncePerActivation | once per target until `Activate` |
| periodic | every Period seconds while they overlap |

Team and Friendly Fire keep attacks off their own side; Team -1 takes the team of the nearest Health above, so a sword on a child node fights for its owner and never hurts it. Knockback is a velocity for a target with Motion 2D and an impulse for a dynamic body; it turns with the hitbox node, so a flipped character pushes the other way. Knockback From Center pushes away from the hitbox instead.

A sword swing is one call:

    if input.Pressed("Attack") {
        Sword.Get<Hitbox2D>().Pulse()
    }

`Pulse()` deals one round of damage in the next step, active or not; `Activate()` and `Deactivate()` switch a hitbox for the length of an attack. `Hit(target, damage)` fires for every target damaged.

Walk over the three spikes in the scene to compare the policies.


![A hitbox selected in the Scene View: area handles and the knockback arrow](shots/hitbox-gizmo.png)
