Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making tile.type and layer.class_ compatible with Tiled 1.9's new Unified Custom Types ("class") #50

Merged
merged 11 commits into from
Jul 18, 2022
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.8.4
* Adding support for `tile.type` using the "class" attribute for Tiled 1.9's Unified Custom Types

## 0.8.3
* Downgrade meta dependency

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Include the following in your `pubspec.yaml`:

```yaml
dependencies:
tiled: 0.8.1
tiled: 0.8.4
```

## Usage
Expand Down
5 changes: 4 additions & 1 deletion lib/src/tileset/tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ class Tile {
static Tile parse(Parser parser) {
return Tile(
localId: parser.getInt('id'),
type: parser.getStringOrNull('type'),

/// Tiled 1.9 "type" has been moved to "class"
type: parser.getStringOrNull('class') ?? parser.getStringOrNull('type'),

probability: parser.getDouble('probability', defaults: 0),
terrain: parser
.getStringOrNull('terrain')
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: tiled
version: 0.8.3
version: 0.8.4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should normally not be bumped in this PR, but since I'll do a release after this is merged it doesn't matter this time.

description: A Dart Tiled library. Parse your TMX files into useful representations. Compatible with Flame.
homepage: https://github.com/flame-engine/tiled.dart

Expand Down