-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding custom classes and types (#14)
new `LeapConfiguration` struct can be added to the `LeapGame` for customization
- Loading branch information
1 parent
9eab90b
commit 6e1e016
Showing
7 changed files
with
148 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/// A configurable class that allows the developer to | ||
/// customize different options that Leap will use | ||
/// when reading the map. | ||
class LeapConfiguration { | ||
const LeapConfiguration({ | ||
this.tiled = const TiledOptions(), | ||
}); | ||
|
||
/// The tiled options, change it to configure how Leap | ||
/// interpret the tiled map. | ||
final TiledOptions tiled; | ||
} | ||
|
||
/// A configurable class specifically about Tiled names, classes and etc. | ||
class TiledOptions { | ||
const TiledOptions({ | ||
this.groundLayerName = 'Ground', | ||
this.metadataLayerName = 'Metadata', | ||
this.playerSpawnClass = 'PlayerSpawn', | ||
this.hazardClass = 'Hazard', | ||
this.damageProperty = 'Damage', | ||
this.platformClass = 'Platform', | ||
this.slopeType = 'Slope', | ||
this.slopeRightTopProperty = 'RightTop', | ||
this.slopeLeftTopProperty = 'LeftTop', | ||
}); | ||
|
||
/// Which layer name should be used for the player, defaults to "Ground". | ||
final String groundLayerName; | ||
|
||
/// Which layer name should be used for the metadata, defaults to "Metadata". | ||
final String metadataLayerName; | ||
|
||
/// Which class name should be used for the player spawn point, | ||
/// defaults to "PlayerSpawn". | ||
final String playerSpawnClass; | ||
|
||
/// Whick class name represents hazard objects, defaults to "Hazard". | ||
final String hazardClass; | ||
|
||
/// Which property name represents damage, defaults to "Damage". | ||
final String damageProperty; | ||
|
||
/// Which class name represents platform objects, defaults to "Platform". | ||
final String platformClass; | ||
|
||
/// Which property name represents the slope type, defaults to "Slope". | ||
final String slopeType; | ||
|
||
/// Which property name represents the slope left bottom, defaults to | ||
/// "RightTop". | ||
final String slopeRightTopProperty; | ||
|
||
/// Which property name represents the slope right bottom, defaults to | ||
/// "LeftTop". | ||
final String slopeLeftTopProperty; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters