• Api Documentation
Show / Hide Table of Contents
  • LdtkParser
    • Direction
    • ILayer
    • ILdtkEntity
    • IWorld
    • LayerType
    • Level
    • World
  • LdtkParser.Exceptions
    • EntityNotFoundException
    • FieldStoreException
    • InvalidTileException
    • TilesetNotFoundException
  • LdtkParser.Graphics
    • ColorConverter
    • Sprite
    • SpriteEnum
    • Tileset
  • LdtkParser.Json
    • BgPos
    • CachedPixelData
    • DefaultOverride
    • Defs
    • Entity
    • EntityInstance
    • Enum
    • FieldDef
    • FieldInstance
    • GridTile
    • Header
    • IntGrid
    • IntGridValue
    • Layer
    • LayerInstance
    • Level
    • Neighbour
    • Param
    • Project
    • RealEditorValue
    • Serialize
    • Tile
    • Tileset
    • TypeClass
    • TypeUnion
    • Value
    • ValueClass
    • ValueUnion
  • LdtkParser.Layers
    • Entities
    • EntityModel
    • EnumValue
    • FieldStore
    • IntGrid
    • Tiles

Class SpriteEnum

A SpriteEnum is simply an Enum that has elements mapping to tiles. This allows us to access arbitrary elements and retrieve the corresponding tile.

It is not strictly necesarry but I figured it was a nice way to define sprite animation/sequences in LDtk and access these easily from code side.

Inheritance
System.Object
SpriteEnum
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: LdtkParser.Graphics
Assembly: LdtkParser.dll
Syntax
public class SpriteEnum

Constructors

SpriteEnum(String, Tileset)

Declaration
public SpriteEnum(string id, Tileset tileset)
Parameters
Type Name Description
System.String id
Tileset tileset

Properties

Identifier

Declaration
public string Identifier { get; }
Property Value
Type Description
System.String

Tileset

Declaration
public Tileset Tileset { get; }
Property Value
Type Description
Tileset

Methods

AddSprite(String, Rectangle)

Declaration
public void AddSprite(string name, Rectangle r)
Parameters
Type Name Description
System.String name
Microsoft.Xna.Framework.Rectangle r

GetSpriteByKey(String)

Returns the sprite identified by key if found

Declaration
public Sprite GetSpriteByKey(string key)
Parameters
Type Name Description
System.String key

A key name.

Returns
Type Description
Sprite

A sprite if found

In This Article
Back to top Generated by DocFX