-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStone.swift
More file actions
34 lines (28 loc) · 933 Bytes
/
Copy pathStone.swift
File metadata and controls
34 lines (28 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Stone.swift
// Flip
//
// Created by Thang Le Tan on 9/26/16.
// Copyright © 2016 Thang Le Tan. All rights reserved.
//
import UIKit
import SpriteKit
class Stone: SKSpriteNode {
//1: create sheared properties for the three possible textures stones can have
static let thinkingTexture = SKTexture(imageNamed: "thinking")
static let whiteTexture = SKTexture(imageNamed: "white")
static let blackTexture = SKTexture(imageNamed: "black")
//2: a method that will set the stone's texture to match the player's color
func setPlayer(_ player: StoneColor) {
if player == .white {
texture = Stone.whiteTexture
} else if player == .black {
texture = Stone.blackTexture
} else if player == .choice {
texture = Stone.thinkingTexture
}
}
//3: the row and column this stone belongs to
var row = 0
var col = 0
}