We feature an extensive support for maps designed in Tiled map editor.
Design your map in Tiled, and save the resulting map (.tmx) along with images (tilesets) somewhere in the project data
subdirectory.
Add to your viewport a TCastleTiledMap
component and set TCastleTiledMap.URL
to indicate your map (.tmx) file.
We support many Tiled features, like
Any number of layers, any map sizes, multiple tilesets.
All map types: Orthogonal, Isometric, IsometricStaggered, Hexagonal.
Flipping of tiles (diagonal, horizontal, vertical).
Optimized rendering with static batching of map layers.
The TCastleTiledMap
is a TCastleTransform
instance, and as such you can move, rotate and scale it.
Inside the viewport you have a regular camera. You can move the camera, you can change the camera orthographic height (TCastleOrthographic.Height
) to zoom in/out. Add the TCastle2DNavigation
component as a child of your viewport to allow user to move/zoom on the map too.
You can control TCastleTiledMap.SmoothScaling
.
false
(default) results in a pixel-art look.
true
means to use smooth (bilinear) filtering for the tile images.
If you see weird seams between tiles when using TCastleTiledMap.SmoothScaling
= true
, this is likely a lack of alpha bleeding. You have to process your tileset image by adding some spacing between tiles and perform alpha bleeding in your image-editing software (you can use our castle-view-image). Alternatively, you can activate TCastleTiledMap.SmoothScalingSafeBorder
to workaround it.
To show/hide specific layers use TCastleTiledMap.Layers
. Click on the button with 3 dots …
at the Layers
property to invoke a nice dialog where you can select layers by names.
The TCastleTiledMap.Map
exposes internal map data (read-only) to query for various information about the map.
To improve this documentation just edit the source of this page in AsciiDoctor (simple wiki-like syntax) and create a pull request to Castle Game Engine WWW (cge-www) repository.
Copyright Michalis Kamburelis and Castle Game Engine Contributors.
This webpage is also open-source and we welcome pull requests to improve it.
We use cookies for analytics. See our privacy policy.