So I'm trying to program a chess app in Xcode 8.3.3 using a tile map node, with an 8x8 tile map containing either a piece or a blank space per tile (made in GameScene.sks, not with code). What I want to do is change a tile. For example, if someone moves a pawn, I want to change the starting space from a pawn to a blank space and then change the ending square from a blank space to a pawn. The tile groups are in a file called pieces.sks, which I made at File->New->File->SpriteKit Tile Set. Here's what I have so far in GameScene.swift (I took out things not relating to the question), goal is to change a single square to a white bishop when the code is run:
class GameScene: SKScene {
var pieces : SKTileMapNode?
override func didMove(to view: SKView) {
self.pieces = self.childNode(withName: "//pieces") as? SKTileMapNode
if let pieces = self.pieces {
pieces.setTileGroup(backgroundGroup*, forColumn: 4, row: 4) //arbitrary square I'm using for testing
}
}
}
So pieces.setTileGroup confuses me for a few reasons, such as the "forColumn" instead of a simple "column". I got it off the Apple Developer Documentation, and am not sure it is the right thing to do what I want. The backgroundGroup (starred in the code) argument is a placeholder. I have no idea how to fill in a white bishop there. Thanks!
I found the answer at https://www.raywenderlich.com/137216/whats-new-spritekit-ios-10-look-tile-maps which was incredibly useful for tile maps in general.
I added:
Origin is in bottom left, as would a standard Cartesian plane's first quadrant.