- Notifications
You must be signed in to change notification settings - Fork31
A Dart Tiled library. Parse your TMX files into useful representations. Compatible with Flame.
NotificationsYou must be signed in to change notification settings
flame-engine/tiled.dart
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Dart Tiled library.
To include the package as a depencency in yourpubspec.yaml
, run the following (or add it manually):
dart pub add tiled
Import the package like this:
import'package:tiled/tiled.dart';
Load a TMX file into a string by any means, and then pass the string to TileMapParser.parseXml():
finalString tmxBody=/* ... */;finalTiledMap mapTmx=TileMapParser.parseTmx(tmxBody);
If your tmx file includes a external tsx reference, you have to add a CustomParser
classCustomTsxProviderextendsTsxProvider {@overrideParsergetSource(String fileName) {final xml=File(fileName).readAsStringSync();final node=XmlDocument.parse(xml).rootElement;returnXmlParser(node); }}
And use it in the parseTmx method
finalString tmxBody=/* ... */;finalTiledMap mapTmx=TileMapParser.parseTmx(tmxBody, tsx:CustomTsxProvider());
Alternatively load a json file.
finalString jsonBody=/* ... */;finalTiledMap mapTmx=TileMapParser.parseJson(jsonBody);
For further information and more usage examples, please take a look at the examples inflame_tiled.
About
A Dart Tiled library. Parse your TMX files into useful representations. Compatible with Flame.
Topics
Resources
Stars
Watchers
Forks
Packages0
No packages published