-
Notifications
You must be signed in to change notification settings - Fork 0
Tile Editor
A tkinter map editor that reads and writes the same JSON TileMap uses.
git clone https://github.com/magmacrunchmedia/texastoast.git
cd texastoast
python tools/tile_editor.pyThe editor lives in the repository, not in the installed package — pip install texastoast does not give you tools/tile_editor.py.
| Action | Control |
|---|---|
| Paint the selected tile | Left click, or click and drag |
| Erase to tile 0 | Right click, or right drag |
| Pick a tile | Click a palette swatch |
| Undo / redo | Ctrl+Z / Ctrl+Y |
| New / open / save | Ctrl+N / Ctrl+O / Ctrl+S |
| Toggle grid lines | Ctrl+G |
| Resize the grid | Edit → Resize Grid |
The status bar shows the tile under the cursor and whether it is solid.
Each palette row has a solid checkbox. That flag decides what goes into
solid_tiles when you save — only ids that are both marked solid and actually
used in the map are written.
Defaults: wall and water are solid; empty, path, door, chest, npc
and sign are not. Change any of them before saving.
In 0.1.x the editor wrote every non-zero id as solid, so a saved map came back with grass, paths, NPCs and signs all acting as walls. If you have maps from that version, open them, set the checkboxes, and re-save — or edit
solid_tilesin the JSON directly.
Opening a map restores its solid flags from the file, so a round trip preserves what you set.
Resizing keeps the overlapping region and fills new cells with 0. Shrinking
discards what falls outside, and that is undoable like any other edit.
{
"grid": [[1, 1, 1], [1, 0, 1], [1, 1, 1]],
"tile_size": 16,
"solid_tiles": [1]
}Load it straight into a game:
from texastoast import TileMap
tilemap = TileMap.from_file("map.json")
tilemap = TileMap.from_file("map.json", solid_tiles={1, 2}) # overrideRows of differing lengths are padded with 0 on load, so a hand-edited file
with a short row will not crash the editor. TileMap itself tolerates ragged
rows, but treats the missing cells as solid — see
Tile Maps and Collision.
The palette colors are the editor's own and are not saved. Your game decides how ids look:
TILE_COLORS = {0: "#7cb342", 1: "#5d4037", 2: "#1e88e5", 3: "#fdd835"}
renderer.draw_tilemap(tilemap, TILE_COLORS)Matching them to the editor's defaults makes what you paint look like what you play. Ids not in the dict are drawn transparent.
texastoast · PyPI · Apache-2.0