en:yaml:tutoriel-2d
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| en:yaml:tutoriel-2d [2026/10/18 23:50] – Relecture 4.17 : clarifications, exemples et typographie cyrilfiesta | en:yaml:tutoriel-2d [2026/10/19 04:19] (Version actuelle) – Retrait du tutoriel 2D et de ses liens, a la demande de l'auteur cyrilfiesta | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | **Language / Langue :** [[fr: | ||
| - | |||
| - | ====== A small 2D board ====== | ||
| - | |||
| - | A board can fit inside one room: numbers describe the terrain, a list holds images, and actions change coordinates. JDR-Bot remains a scenario engine; movement and collision rules are written by the author. | ||
| - | |||
| - | ===== A cell and its image ===== | ||
| - | |||
| - | On a 7-column board, a cell number is '' | ||
| - | |||
| - | <code yaml> | ||
| - | title: The garden | ||
| - | vars: | ||
| - | x: 1 | ||
| - | y: 1 | ||
| - | cell: 0 | ||
| - | lists: | ||
| - | terrain: [ | ||
| - | 0, 0, 0, 0, 0, 0, 0, | ||
| - | 0, 1, 1, 1, 1, 1, 0, | ||
| - | 0, 1, 1, 0, 1, 1, 0, | ||
| - | 0, 1, 1, 0, 1, 1, 0, | ||
| - | 0, 1, 1, 0, 1, 1, 0, | ||
| - | 0, 1, 1, 1, 1, 1, 0, | ||
| - | 0, 0, 0, 0, 0, 0, 0 | ||
| - | ] | ||
| - | grid: [] | ||
| - | tiles: [ | ||
| - | / | ||
| - | / | ||
| - | / | ||
| - | ] | ||
| - | </ | ||
| - | |||
| - | The terrain holds 49 values in one list: 0 means wall and 1 means floor. Images come from the Mini Doom tileset supplied with the Web/Desktop project. On another host, provide that image too or change its address. | ||
| - | |||
| - | ===== Rebuild the display ===== | ||
| - | |||
| - | Add this automatic event and its room after the declarations: | ||
| - | |||
| - | <code yaml> | ||
| - | global_events: | ||
| - | - id: draw_board | ||
| - | state: ' | ||
| - | do: | ||
| - | - do: | ||
| - | - list: grid | ||
| - | keep: 0 | ||
| - | - for_each: floor | ||
| - | in: terrain | ||
| - | do: | ||
| - | - {list: grid, append: ' | ||
| - | - cell = v_y_v | ||
| - | - cell * 7 | ||
| - | - cell + v_x_v | ||
| - | - text_var: grid[v_cell_v] | ||
| - | value: t_tiles[2]_t | ||
| - | rooms: | ||
| - | - id: garden | ||
| - | auto_refresh: | ||
| - | text: ' | ||
| - | </ | ||
| - | |||
| - | Combine the two blocks in one YAML file to view the board with Test. The text uses '' | ||
| - | |||
| - | ===== Add rules ===== | ||
| - | |||
| - | - **Movement**: | ||
| - | - **Key**: a collection '' | ||
| - | - **Exit**: check position and '' | ||
| - | - **Random placement**: | ||
| - | |||
| - | Choose positions during setup, not after every move. The scenario must ensure the selected cells are reachable: the grid does not find paths. | ||
| - | |||
| - | ===== With the editor ===== | ||
| - | |||
| - | Create numbers, lists and collections under **Globals > Variables**. Add loops and operations in an event' | ||
| - | |||
| - | Test walls, the key, the exit and Restart. **Test data** lets you inspect coordinates and lists in a separate window without resizing the game. | ||
| - | |||
| - | The source files include two French tutorials building **La clé du jardin** in five steps: '' | ||
| - | |||
| - | See [[en: | ||
en/yaml/tutoriel-2d.1792360237.txt.gz · Dernière modification : de cyrilfiesta
