Last active
August 29, 2015 14:23
-
-
Save andymuncey/f9e5338fa9a4732528e1 to your computer and use it in GitHub Desktop.
Example Swift code to create a rectangular SKSpriteNode with solid colour
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
//create node | |
var rectangleSpriteNode = SKSpriteNode() | |
//set sprite colour | |
rectangleSpriteNode.color = UIColor.yellowColor() | |
//set 100 width by 500 high | |
rectangleSpriteNode.size = CGSizeMake(100, 50) | |
//set the position of the node's centre (200 points across, 100 points up) | |
rectangleSpriteNode.position = CGPointMake(200, 100) | |
//add it to the screem | |
addChild(rectangleSpriteNode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment