> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dotouch-emu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getDistance

> Calculer la distance (en cellules) entre deux positions.

Calculer la distance (en cellules) entre deux positions.

#### 🎮 Méthode

```lua theme={null}
fightAction:getDistance(cellIdStart, cellIdEnd)
```

#### 📝 Arguments

| Nom           | Type  | Description             |
| ------------- | ----- | ----------------------- |
| `cellIdStart` | `int` | Cellule de départ.      |
| `cellIdEnd`   | `int` | Cellule de destination. |

#### 💎 Valeur de retour

| Type  | Description                     |
| ----- | ------------------------------- |
| `int` | Distance en nombre de cellules. |

#### 💡 Exemple

```lua theme={null}
local myCell = fightCharacter:getCellId()
local enemyCell = fightAction:getNearestEnemy()
local dist = fightAction:getDistance(myCell, enemyCell)
if dist > 1 then
    fightAction:moveToWardCell(enemyCell)
end
if dist == 1 then
    fightDebug:print("Portée corps-à-corps !")
end
```
