---
title: "Dodge i-frames: dash invincibility and the cooldown rule"
description: "A dodge dash grants invincibility frames: 0.21 s of protection on a 0.16 s dash. The cooldown must be twice that, or mashing wins. See it and play it."
date: 2026-11-18
url: https://valdemird.com/blog/dodge-dash-i-frames/
lang: en
tags: ["game-feel", "game-design", "godot", "combat"]
---

**Playable sheet: Dodge dash** (the real game, in the page)

- Video: https://valdemird.com/videos/play/platformer-lab/combate-c_dodge.mp4 (Dashes through the damage curtains. With dash i-frames it passes untouched; after T the same dashes take the hit.)
- Play: https://valdemird.com/play/platformer-lab/index.html?plano=combate&lamina=c_dodge&lang=en

How to try it:
1. Run right with → toward the first curtain. There's wall above it, so you can't jump. Press X just before it and the dash carries you through untouched.
2. The double curtain is two tiles wide. One dash covers 3.6, so it fits.
3. In the tunnel there's no room to jump. The pile driver warns and then strikes: dash with X through the shockwave when it reaches you.
4. Press T and dash through the same curtain. The dash moves you exactly the same, but now it costs a mask.

# Dodge i-frames: dash invincibility and the cooldown rule

> A dodge dash grants invincibility frames: 0.21 s of protection on a 0.16 s dash. The cooldown must be twice that, or mashing wins. See it and play it.

A **dodge dash** grants invincibility frames while it lasts, so you go through attacks instead of over them. Here that's the **0.16 s** of the dash plus 0.05 s for the exit, and a **0.45 s** cooldown keeps mashing from making you untouchable.

**One dash, until the next.**
- i-frames (210 ms): with the technique, Untouched: n ms of protection left. Without it, Hit: without dash i-frames, you lose a mask.
- vulnerable gap (240 ms): with the technique, Hit. You can dash again in n ms. Without it, Hit. You can dash again in n ms.

Dash i-frames: through the attack, not over it

Jumping dodges what comes along the floor, but it leaves you in the air and far from the enemy. A sideways dash dodges and places you: you come out on the other side, behind whoever attacked, with their recovery still ahead of them. The extra 0.05 s covers the instant after the dash when you may still overlap what you went through. Hollow Knight's [Shade Cloak](https://hollowknight.wiki.fextralife.com/Shade+Cloak) works the same way: it lets you "dash through enemies and their attacks without taking damage."

The cooldown rule: at least twice the protection

If the cooldown counts from the start of the dash, someone mashing the button is protected at most protection ÷ cooldown of the time. With 0.21 s of protection, a 0.22 s cooldown would make you untouchable 95% of the time, and the dash would become the fastest way to walk. At 0.45 s it's 47% at most, and between two dashes there's always a vulnerable gap of 0.24 s, longer than the protected one. The Shade Cloak recharges in about 1.5 s.

How to implement dash i-frames

1. **Don't add a dodge state.** When the dash starts, grant invulnerability for its length plus a small margin, on the same timer the i-frames after a hit use.
2. **Cancel any attack in progress when the dash starts.** Otherwise a slash thrown just before travels inside the dash, untouchable and hitting at once.
3. **Set the cooldown to at least twice the protection,** counted from the start of the dash.
4. **Don't protect against hazards.** Spikes and pits ignore invulnerability, or a dodge would cross any spike pit 3.6 tiles at a time.

**The code in Godot 4.**

`addons/combat_kit/player/player_combat.gd`:

```gdscript
## Lo que dura de más la protección del dash respecto al dash: cubre la salida.
const DASH_GUARD_EXTRA := 0.05
# ...
	player.dash_started.connect(_on_dash_started)
# ...
func _on_dash_started(_direction: Vector2) -> void:
	_cancel_attack()
	if Lab.on(&"dash_iframes"):
		health.grant_invulnerability(player.params.dash_time + DASH_GUARD_EXTRA)
```

`addons/platformer_kit/player/movement_params.gd`:

```gdscript
@export_range(0.05, 0.4, 0.005, "suffix:s") var dash_time := 0.16
## ESPERA entre dos dashes, contada desde que EMPIEZA el primero (en el aire no
## hace falta: hay uno por vuelo). No es un detalle: con el dash protegido
## (`dash_iframes`), una espera corta convierte aporrear el botón en ser
## intocable casi todo el tiempo y en la forma más rápida de andar. La regla:
## al menos el doble de lo que dura la protección, para que entre dos dashes
## haya siempre una ventana vulnerable tan larga como la protegida.
@export_range(0.0, 1.0, 0.01, "suffix:s") var dash_cooldown := 0.45
```

`grant_invulnerability()` fills the same timer as the [i-frames after a hit](/blog/health-damage-invincibility-frames/) and keeps the larger value, so a dash never shortens protection you already had.

Quick answers

How long should dash i-frames last?

The length of the dash plus a small margin for the exit: 0.16 s plus 0.05 s, so 0.21 s here.

Does a dodge dash protect you from spikes?

Not here, and Hollow Knight's Shade Cloak doesn't either. The dodge is for attacks, things that come at you with a warning.
