Tagged: #МобильныеИгры

(Swift) zPosition.

sloi1 = SKSpriteNode (imageNamed: "slot1")
sloi1.size = CGSize(width: 36, height: 40)
sloi1.position = CGPoint(x: 183, y: 380)
sloi1.zPosition = 10
self.addChild(sloi1)
//
sloi2 = SKSpriteNode (imageNamed: "slot2")
sloi2.size = CGSize(width: 36, height: 40)
sloi2.position = CGPoint(x: 183, y: 380)
sloi2.zPosition = 20
self.addChild(sloi2)

Divide your objects into layers help zPosition property. The default value is 0.0. The positive z axis is projected toward the viewer so that nodes with larger z values ​​are closer to the viewer. When a node tree is rendered, the height of each node (in absolute coordinates) is calculated and then all nodes in the tree are rendered from smallest z value to largest z value. If multiple nodes share the same z position, those nodes are sorted so that parent nodes are drawn before their children, and siblings are rendered in the order...

Read & comments