AudioAsset
Ease
FastString
FontAsset
NineSlice
PackedSprite
PackedSpriteID
RB
   HardwareSettings
   IRetroBlitGame
RBAsset
Rect2i
ShaderAsset
SoundReference
SpriteGrid
SpriteSheetAsset
TMXMapAsset
   TMXLayer
   TMXLayerLoadState
   TMXObject
   TMXObjectGroup
   TMXProperties
Vector2i

RB.MapSpriteGet

Method  -  Static

public static int MapSpriteGet(int layer, Vector2i tilePos)

Parameters

layer int Map layer
tilePos Vector2i Tile position

Returns

int

Sprite index or id

Description

Get the tilemap sprite at the given layer and tile position. If the the sprite sheet set with RB.MapLayerSpriteSheetSet is from an image grid then the sprite corresponds to the sprite index in the sprite sheet. If the sprite sheet represents a sprite pack then sprite corresponds to the packed sprite id.

Example

const int LAYER_TERRAIN = 0;

void Update() {
    int tile = RB.MapSpriteGet(LAYER_TERRAIN, playerTilePos);

    if (tile == RB.PackedSpriteID("fire").id) {
        playerHealth -= 1;
    }
}

See Also

RB.MapSpriteSet
RB.MapLayerSpriteSheetSet

See Docs

Features - Tilemaps
Features - Setting or Getting Tile Info