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 |