Sknode color or texture

I am working on creating a “menu” with SKNode being the background of the menu, and linking SKSpriteNodes as parameters of the child elements.

The problem is that I cannot figure out how to add color or texture or something to SKNode to serve as a backdrop for the menu; there are no .size, .texture, .color, or .background / .backgroundcolor options.

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

+4
source share
1 answer

I will create a 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)
+6
source

Source: https://habr.com/ru/post/1568472/


All Articles