Created
March 2, 2017 10:28
-
-
Save KyleGoslan/4e5d27a80adc12aa05537c5bbdc15cd1 to your computer and use it in GitHub Desktop.
Method that loops through each tile, with a callback that return the col, row and tile definition.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension SKTileMapNode { | |
func loopThroughTiles(completionClosure: (_ col: Int, _ row: Int, _ tile: SKTileDefinition?) -> ()) { | |
for col in 0..<numberOfColumns { | |
for row in 0..<numberOfRows { | |
completionClosure(col, row, tileDefinition(atColumn: col, row: row)) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment