타일드 패키지는 Tiled 지도 편집기에서 생성한 TMX 파일을 파싱하고 게임 개발에 사용할 수 있는 구조화된 데이터로 변환하는 Dart 라이브러리입니다. 플레임 게임 엔진과 원활하게 통합되어 다양한 플랫폼에서 타일맵을 효율적으로 로드하고 렌더링할 수 있도록 해줍니다. 레이어, 오브젝트, 타일셋 등의 다양한 Tiled 기능을 지원하여 2D 게임 개발에 적합합니다. 깔끔하고 직관적인 API를 통해 수동 데이터 처리 없이도 맵 통합을 간편하게 할 수 있습니다.
사용 사례
게임에서 2D 타일맵 로딩
Flame 엔진과 Tiled 지도 통합
계층화된 게임 레벨 렌더링
TMX 파일에서 충돌 객체 처리
플랫폼 또는 퍼즐 게임 만들기
주요 기능
TMX 파일 파싱을 지원합니다
플레임 게임 엔진과 호환됩니다
크로스 플랫폼 지원
타일셋과 레이어를 처리합니다
객체 및 충돌 데이터를 제공합니다
적합한 대상
Flame을 사용하는 2D 게임 개발자
Tiled 지도 사용자가 Dart 통합을 찾고 있습니다
크로스 플랫폼 게임 프로젝트
인디 게임 제작자
게임 프로토타이핑
고려 사항
TMX 형식의 Tiled 지도 파일이 필요합니다
2D 타일맵 사용 사례에 한정
완전한 렌더링을 위해서는 Flame에 의존합니다
사용자 정의 Tiled 플러그인에 대한 직접 지원 없음
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Tiled Dart
A Dart Tiled library.
Install from Dart Pub Repository
To include the package as a dependency in your pubspec.yaml, run the following (or add it manually):
dart pub add tiled
Usage
Import the package like this:
import'package:tiled/tiled.dart';
Load Tmx Files
Load a TMX file into a string by any means, and then pass the string to TiledMap.parseTmx():
If your map references external files, like external tilesets (.tsx) or object templates
(.tx), you have to pass one or more ParserProviders that resolve these files. Every time the
parser encounters a reference to an external file, the first provider that canProvide the
referenced path is asked for a Parser of its contents through getSource.
The path is always relative to the map file, also for files referenced from other external files,
so a single provider can resolve any number of files, for example everything below a directory:
Parser.fromString creates an XmlParser or a JsonParser depending on the contents. Every file
is requested at most once per parsed map.
Objects that use a template inherit every value they do not specify themselves from the object of
the template, and their gid is translated to the tilesets of the map. When the map does not
contain the tileset of the template it is added to TiledMap.tilesets, like Tiled does when loading
the map.
The providers are passed to parseTmx or parseJson:
When the external files can only be loaded asynchronously, for example from an asset bundle, use
TiledMap.fromString instead. It parses either tmx or json and loads every referenced file, also
the ones referenced from other external files, with the given loader before returning the map: