Is there a way to set isPaused = true for a SKSpriteNode and keep its SKEmitterNode child node moving?

Can you set isPaused = true of a SKSpriteNode and keep its SKEmitterNode still moving?

Answered by DTS Engineer in 796721022

Hello @JohnLove, isPaused is documented as applying to the descendants of a node as well.

You could reparent the emitter node to a non-paused node when you want to pause the sprite node, but make sure that the non-paused node is updated to match the transform of the sprite node when you go to pause it.

Best regards,

Greg

Hello @JohnLove, isPaused is documented as applying to the descendants of a node as well.

You could reparent the emitter node to a non-paused node when you want to pause the sprite node, but make sure that the non-paused node is updated to match the transform of the sprite node when you go to pause it.

Best regards,

Greg

Thanks bunches, Greg for responding!

I guess I need to find out how to override isPaused so that for my Emitters, the emitters always set isPaused = false, which overrides the default behavior, namely, whatever the super class has for isPaused trickles down hill to the children.

I need to find out how to override isPaused so no matter what the superclass specifies and tries to impose isPaused on its children, my EmitterScene class always returns isPaused = flase.

Currently, I have:

class EmitterScene: SKScene {

    override var isPaused: Bool {
        get {
            return false
        }
        set {
            // deliberately left empty
        }
    }

}

Not working .. my strong suspicion is that the not working is due to a monumental syntax error that still compiles okay, but just doesn't work.

Yes, I know isPaused belongs to SKNode

Thanks again bunches and bunches for "having pity on me"

John

Hey @JohnLove,

I don't think overriding is necessary here. Instead, try implementing the reparenting strategy I mentioned previously!

Best regards,

Greg

Yes, I have a published App, but I've only been at this for 9 months. Bunches to still learn about, including re-parenting.

Will return to you, guaranteed, after I drink from the re-parenting firehose.

John

Okay, I'm back.

I am still enjoying learning about re-parenting.

In the meantime ... instead of adding the particle emitter as a child of myTrain, I place the particle emitter as a child of GameScene, which obviously isn't moving/

SOLVED

Now, back to re-parenting ...

Is there a way to set isPaused = true for a SKSpriteNode and keep its SKEmitterNode child node moving?
 
 
Q