TKTileFlag Constants Reference

Declared in TKEnums.h


The Tile flip flags determine how a tile is flipped and/or rotated. These flags are encoded into the TKTileGID on a tile layer.

Usage examples:

// test if a specific bit is set: if (tileGID & TKTileFlagDiagonalFlip) { .. }

// test if at least one of these bits is set: if (tileGID & (TKTileFlagVerticalFlip | TKTileFlagHorizontalFlip)) { .. }

// extract flags from tile GID (removes the tile GID leaving only the flags) TKTileFlag flags = (tileGID & TKTileFlagAll);

// extract GID from tile GID (removes all flags) TKTileGID tileWithoutFlags = (tileGID & TKTileFlagMask);

Note: TKTileLayer methods allow you to get a tile’s GID with ([TKTileLayer tileWithFlagsAtX:Y:]) or without ([TKTileLayer tileAtX:Y:]) flags, or just the flags ([TKTileLayer tileFlagsAtX:Y:]).


typedef NS_OPTIONS(TKTileGID, TKTileFlag ) {
   TKTileFlagNone = 0,
   TKTileFlagAnimated = 1 < < 24,
   TKTileFlagAnimatedAtCoord = 1 < < 25,
   TKTileFlagDiagonalFlip = 1 < < 29,
   TKTileFlagVerticalFlip = 1 < < 30,
   TKTileFlagHorizontalFlip = ( TKTileGID ) ( 1 < < 31 ),
   TKTileFlagAllFlipFlags = ( TKTileFlagHorizontalFlip | TKTileFlagVerticalFlip | TKTileFlagDiagonalFlip ),
   TKTileFlagAll = ( TKTileFlagHorizontalFlip | TKTileFlagVerticalFlip | TKTileFlagDiagonalFlip | TKTileFlagAnimated | TKTileFlagAnimatedAtCoord ),
   TKTileFlagMask = ~ ( TKTileFlagAll ),



No tile flags are set.

Declared In TKEnums.h.


Set if the tile GID has a tile animation and may need to use a different GID depending on animation state.

Declared In TKEnums.h.


Set if the animation runs specifically at this coordinate (ie asynchronous playback). Meaning there’s a TKTileAnimation instance specifically for this particular tile layer and coordinate.

Declared In TKEnums.h.


Set if the tile is rotated diagonally.

Declared In TKEnums.h.


Set if the tile is vertically flipped.

Declared In TKEnums.h.


Set if the tile is horizontally flipped

Declared In TKEnums.h.


All three flip flags OR'ed together.

Declared In TKEnums.h.


All flags OR'ed together. Can be used to extract the flags of a tile: (tile & TKTileFlagAll).

Declared In TKEnums.h.


Bitwise negation of TKTileFlagAll, ie all bits are set except for the flags. To mask out (remove) all flags from a TKTileGID: (tile & TKTileFlagMask)

Declared In TKEnums.h.

Declared In