getWidth(); $h = $map->getHeight(); // calculer centre approximatif $centerQ = (int) floor($w / 2); $centerR = (int) floor($h / 2); // placer un petit quartier de bâtiments autour du centre for ($dq = -1; $dq <= 1; $dq++) { for ($dr = -1; $dr <= 1; $dr++) { $q = $centerQ + $dq; $r = $centerR + $dr; if ($map->isValidCoordinate($q, $r)) { $map->setTile($q, $r, new Tile(['type' => 'building'])); } } } // tracer deux routes en croix for ($q = 0; $q < $w; $q++) { if ($map->isValidCoordinate($q, $centerR)) { $map->setTile($q, $centerR, new Tile(['type' => 'road'])); } } for ($r = 0; $r < $h; $r++) { if ($map->isValidCoordinate($centerQ, $r)) { $map->setTile($centerQ, $r, new Tile(['type' => 'road'])); } } } public static function tileDefinitions(): array { return [ 'empty' => ['label' => 'Vide', 'walkable' => true], 'building' => ['label' => 'Bâtiment', 'walkable' => false], 'road' => ['label' => 'Route', 'walkable' => true], 'park' => ['label' => 'Parc', 'walkable' => true] ]; } } }