Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class TilemapLayer

    Represents a single layer within a tilemap. Contains tile data and layer-specific properties.

    Inheritance
    object
    TilemapLayer
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: PopcorningGuineaPig.Engine.Gameplay
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public class TilemapLayer

    Constructors

    | Edit this page View Source

    TilemapLayer(string, int, int)

    Creates a new tilemap layer with specified dimensions.

    Declaration
    public TilemapLayer(string name, int width, int height)
    Parameters
    Type Name Description
    string name

    Layer name

    int width

    Width in tiles

    int height

    Height in tiles

    Properties

    | Edit this page View Source

    Height

    Declaration
    public int Height { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Name

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Opacity

    Declaration
    public float Opacity { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    Properties

    Declaration
    public Dictionary<string, string> Properties { get; set; }
    Property Value
    Type Description
    Dictionary<string, string>
    | Edit this page View Source

    Visible

    Declaration
    public bool Visible { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Width

    Declaration
    public int Width { get; set; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Clear()

    Clears all tiles in the layer (sets all to 0).

    Declaration
    public void Clear()
    | Edit this page View Source

    GetTileCount()

    Gets the number of non-empty tiles in the layer.

    Declaration
    public int GetTileCount()
    Returns
    Type Description
    int

    Count of tiles

    | Edit this page View Source

    GetTileId(int, int)

    Gets the tile ID at the specified coordinates.

    Declaration
    public int GetTileId(int x, int y)
    Parameters
    Type Name Description
    int x

    X coordinate

    int y

    Y coordinate

    Returns
    Type Description
    int

    Tile ID, or 0 if empty or out of bounds

    | Edit this page View Source

    HasTiles()

    Checks if the layer contains any non-empty tiles.

    Declaration
    public bool HasTiles()
    Returns
    Type Description
    bool

    True if the layer has any tiles

    | Edit this page View Source

    LoadFromArray(int[])

    Loads tile data from a flat array (as typically found in TMX files).

    Declaration
    public void LoadFromArray(int[] data)
    Parameters
    Type Name Description
    int[] data

    Flat array of tile IDs

    | Edit this page View Source

    SetTileId(int, int, int)

    Sets the tile ID at the specified coordinates.

    Declaration
    public void SetTileId(int x, int y, int tileId)
    Parameters
    Type Name Description
    int x

    X coordinate

    int y

    Y coordinate

    int tileId

    Tile ID to set

    | Edit this page View Source

    ToArray()

    Exports tile data to a flat array.

    Declaration
    public int[] ToArray()
    Returns
    Type Description
    int[]

    Flat array of tile IDs

    | Edit this page View Source

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()
    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.