Skip to content

Instantly share code, notes, and snippets.

@andymuncey
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andymuncey/f9e5338fa9a4732528e1 to your computer and use it in GitHub Desktop.
Save andymuncey/f9e5338fa9a4732528e1 to your computer and use it in GitHub Desktop.
Example Swift code to create a rectangular SKSpriteNode with solid colour
//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