Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sknode color or texture

I'm working on making a "menu" with SKNode being the menu background, and a bunch of SKSpriteNodes as the child element options.

The problem is I can't figure out how to add a color or texture or something to the SKNode to serve as a background to the menu; there are no .size, .texture, .color, or .background/.backgroundcolor method options

should I use an SKSpriteNode with other SKSpriteNodes inside, or should I maybe use an SKScene instead with SKSpriteNodes inside? or is there a way to assign an SKNode a background image or color?

like image 907
duxfox-- Avatar asked Dec 20 '14 18:12

duxfox--


1 Answers

I will create red sprite for example

let sprite = SKSpriteNode(color: UIColor.redColor(), size: CGSizeMake(20, 20))
                sprite.position = CGPointMake(self.size.width/2, self.size.height/2)
                addChild(sprite)
like image 190
Valar Morghulis Avatar answered Nov 03 '22 03:11

Valar Morghulis