Skip to content

Commit

Permalink
feat: adding support for "Tags" property on tiles (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtome authored Dec 1, 2024
1 parent 41328ae commit 482eea5
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 37 deletions.
54 changes: 27 additions & 27 deletions examples/standard_platformer/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
url: "https://pub.dev"
source: hosted
version: "2.11.0"
version: "2.12.0"
audioplayers:
dependency: transitive
description:
Expand Down Expand Up @@ -93,10 +93,10 @@ packages:
dependency: transitive
description:
name: crypto
sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.6"
ffi:
dependency: transitive
description:
Expand All @@ -109,34 +109,34 @@ packages:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
url: "https://pub.dev"
source: hosted
version: "7.0.0"
version: "7.0.1"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.1.1"
flame:
dependency: "direct main"
description:
name: flame
sha256: e6873a8540a197a9bfe251e10c9e1f200329041d6e6d70df2cf38aa681cf2ef7
sha256: c02390443e40a2a9034ac867d0789ab32f215eba4779bff4655a7143eb3d75d0
url: "https://pub.dev"
source: hosted
version: "1.19.0"
version: "1.22.0"
flame_audio:
dependency: "direct main"
description:
name: flame_audio
sha256: a86839f1448bbf9e2cd9c5d396be8dfc745428a9d27db6dfcdd9680466d8370e
sha256: "656433a6a448dd74c1a10ae56fc7fb389d5df89cb6a5038870c2793e1f0ddc99"
url: "https://pub.dev"
source: hosted
version: "2.10.3"
version: "2.10.6"
flame_behaviors:
dependency: transitive
description:
Expand Down Expand Up @@ -192,7 +192,7 @@ packages:
path: "../../packages/leap"
relative: true
source: path
version: "0.8.2"
version: "0.8.3"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -221,34 +221,34 @@ packages:
dependency: transitive
description:
name: ordered_set
sha256: "3129515e563a14817adebbdeee2acbb845fc69b6fc99a94349b641d1c829d5cd"
sha256: fc861bb51fc863cd3e0718e21768af9586e0d5022b91a0fd4437636456cdb7d0
url: "https://pub.dev"
source: hosted
version: "6.1.0"
version: "6.1.1"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
version: "1.9.1"
path_provider:
dependency: transitive
description:
name: path_provider
sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.1.5"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: f7544c346a0742aee1450f9e5c0f5269d7c602b9c95fdbcd9fb8f5b1df13b1cc
sha256: "8c4967f8b7cb46dc914e178daa29813d83ae502e0529d7b0478330616a691ef7"
url: "https://pub.dev"
source: hosted
version: "2.2.11"
version: "2.2.14"
path_provider_foundation:
dependency: transitive
description:
Expand Down Expand Up @@ -293,10 +293,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
url: "https://pub.dev"
source: hosted
version: "3.1.5"
version: "3.1.6"
plugin_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -330,10 +330,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
sha256: "0bd04f5bb74fcd6ff0606a888a30e917af9bd52820b178eaa464beb11dca84b6"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.0"
synchronized:
dependency: transitive
description:
Expand Down Expand Up @@ -362,10 +362,10 @@ packages:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
url: "https://pub.dev"
source: hosted
version: "1.3.2"
version: "1.4.0"
uuid:
dependency: transitive
description:
Expand Down
9 changes: 9 additions & 0 deletions packages/leap/lib/src/leap_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ class LeapMapGroundTile extends PhysicalEntity {
tags.add(tile.class_!);
}

// Additionally add any strings in the "Tags" property
final tagsProperty = tile.properties
.getValue<String>(tiledOptions.tagsProperty)
?.split(',')
.map((s) => s.trim());
if (tagsProperty != null) {
tags.addAll(tagsProperty);
}

hazardDamage = tile.properties.getValue<int>(
tiledOptions.damageProperty,
) ??
Expand Down
4 changes: 4 additions & 0 deletions packages/leap/lib/src/leap_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class TiledOptions {
this.playerSpawnClass = 'PlayerSpawn',
this.damageProperty = 'Damage',
this.platformClass = 'Platform',
this.tagsProperty = 'Tags',
this.rightTopProperty = 'RightTop',
this.leftTopProperty = 'LeftTop',
this.rightBottomProperty = 'RightBottom',
Expand Down Expand Up @@ -51,6 +52,9 @@ class TiledOptions {
/// Which class name represents platform objects, defaults to "Platform".
final String platformClass;

/// Strings to add to `tags`, comma separated
final String tagsProperty;

/// Which property name represents the left top, defaults to
/// "RightTop".
final String rightTopProperty;
Expand Down
20 changes: 10 additions & 10 deletions packages/leap/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ packages:
dependency: transitive
description:
name: crypto
sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.6"
fake_async:
dependency: transitive
description:
Expand All @@ -69,10 +69,10 @@ packages:
dependency: "direct main"
description:
name: flame
sha256: e6873a8540a197a9bfe251e10c9e1f200329041d6e6d70df2cf38aa681cf2ef7
sha256: c02390443e40a2a9034ac867d0789ab32f215eba4779bff4655a7143eb3d75d0
url: "https://pub.dev"
source: hosted
version: "1.19.0"
version: "1.22.0"
flame_behaviors:
dependency: "direct main"
description:
Expand All @@ -93,10 +93,10 @@ packages:
dependency: "direct main"
description:
name: flame_tiled
sha256: bb00888e0893413ffeb083e24cee3d5f7c08cbae5d8df551f14a564fdf7c5282
sha256: a41b35fd2f74adb5f3860103b53d8de750771b0ff34ba67df57b913ff887de63
url: "https://pub.dev"
source: hosted
version: "1.20.3"
version: "1.21.1"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -167,10 +167,10 @@ packages:
dependency: transitive
description:
name: ordered_set
sha256: "3129515e563a14817adebbdeee2acbb845fc69b6fc99a94349b641d1c829d5cd"
sha256: fc861bb51fc863cd3e0718e21768af9586e0d5022b91a0fd4437636456cdb7d0
url: "https://pub.dev"
source: hosted
version: "6.1.0"
version: "6.1.1"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -252,10 +252,10 @@ packages:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
url: "https://pub.dev"
source: hosted
version: "1.3.2"
version: "1.4.0"
vector_math:
dependency: transitive
description:
Expand Down

0 comments on commit 482eea5

Please sign in to comment.