Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32
A Dart Tiled library. Parse your TMX files into useful representations. Compatible with Flame.
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 dependency 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 an 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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.