Particle emitter does not display above image (quick spritekit)

This is a pretty simple question (Im new with fast and spritekit). So in any case, Im adds a particle emitter to the spritenode (call it the ball) and add the ball to my scene. This ball is on top of another spritenode that represents the background. When I launch the application, the ball looks great, but the particle emitter is not displayed. The issuer shows perfectly when I remove the background, but do not add the background. I will send sample code ...

//Background
let background = SKSpriteNode(imageNamed:"Background")
background.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame))
background.zPosition = 0
self.addChild(background)

//Ball
let ball = SKSpriteNode(imageNamed: "ball")
ball.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame))
ball.zPosition = 1
ball.physicsBody = SKPhysicsBody(rectangleOfSize: ball.frame.size)
ball.physicsBody?.usesPreciseCollisionDetection = true 


//Emitter
let emitter = SKEmitterNode(fileNamed: "emitter")
emitter.targetNode = self

ball.addChild(emitter)

self.addChild(ball)

As I said, this is a pretty simple question. I just don't know what I'm doing wrong. To repeat, when I run this, the emitter does not show. But if I take the background, the emitter will show.

Thanks for the help:)

+4
3

- , zPosition ( , ). zPosition , , , ( , ).

, - , , .

+1

zPosition . zPosition -1, . , -. :)

+1

, , , , , GameViewController , false. skView.ignoresSiblingOrder = false

0

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


All Articles