renamed particle* to animation*, added asesprite animation loading

This commit is contained in:
2024-04-02 20:05:23 +02:00
parent 20fa2639c6
commit 001b67f97a
14 changed files with 673 additions and 162 deletions

View File

@@ -11,7 +11,6 @@ type TileSetSubRect struct {
}
func Map2Subrect(raw map[string]any) *TileSetSubRect {
// we need to translate this map for less typing
return &TileSetSubRect{
W: int(raw["w"].(float64)),
@@ -37,8 +36,25 @@ func GetPropertyRef(entity *ldtkgo.Entity) string {
return ""
}
func GetPropertyToggleTile(entity *ldtkgo.Entity) *TileSetSubRect {
func GetPropertyString(entity *ldtkgo.Entity, property string) string {
ref := entity.PropertyByIdentifier(property)
if ref != nil {
return ref.AsString()
}
return ""
}
func GetPropertyBool(entity *ldtkgo.Entity, property string) bool {
ref := entity.PropertyByIdentifier(property)
if ref != nil {
return ref.AsBool()
}
return false
}
func GetPropertyToggleTile(entity *ldtkgo.Entity) *TileSetSubRect {
ref := entity.PropertyByIdentifier(config.LDTK_Toggle_Tile)
if ref != nil {
return Map2Subrect(ref.AsMap())