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
self.enumerateChildNodesWithName("PurchaseMenu", usingBlock: | |
{ (node: SKNode!, stop: CMutablePointer<ObjCBool>) in | |
node.removeFromParent() | |
} | |
) |
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
scene.enumerateChildNodesWithName("flag") { | |
node, stop in | |
let realNode = node as Flag | |
realNode.hidePurchaseMenus() | |
} |
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
// How do you cast SKNode to Flag : SKNode in parameter definition? | |
scene.enumerateChildNodesWithName("flag") { | |
node as Flag, stop in | |
node.methodAvailableToFlagObject() | |
} | |
// I'm trying to avoid having to do this: | |
scene.enumerateChildNodesWithName("flag") { |
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
scene.enumerateChildNodesWithName("PurchaseMenu") { | |
node, stop in | |
node.removeFromParent() | |
} |
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
let path = NSBundle.mainBundle().bundlePath + "/FlagProgression.pList" | |
let pListData = NSDictionary(contentsOfFile:path) | |
let flagData = pListData[self.category.toRaw()] as NSArray | |
return flagData.objectAtIndex(self.currentLevel) as Dictionary<String, String>[] |
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
for item : NSDictionary! in flagData { | |
let flagToPlace = Flag(category: item["Type"].integerValue) | |
} |
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
init(category:Int) { | |
super.init(texture: FlagSingleton.textures[category]) | |
} | |
init(texture:SKTexture, color:SKColor, size:CGSize) { | |
super.init(texture:texture, color:color, size:size) | |
} |
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
init(category:Int) { | |
super.init(texture: FlagSingleton.textures[category], color:SKColor.whiteColor(), size:FlagSingleton.textures[category].size()) | |
} |
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
import SpriteKit | |
import Foundation | |
class Squad : SKNode { | |
// Handle on all units in the squad. | |
var units : Array<CharacterNode> = [] | |
// Current formation technique | |
var formation : Formation? |
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
import SpriteKit | |
class Formation { | |
// The vectors for a 3x3 formation. | |
var positions : Array<CGVector> = [ | |
CGVectorMake(0, 0), | |
CGVectorMake(-64, 0), | |
CGVectorMake(64, 0), | |
CGVectorMake(-64, 64), |