Is there a way to only run a SKemitter one time? I have a explosion when it is colliding with another node. The problem is that the explosion happens multiple times since it hits multiple times. How would I go about only running it once time?
1
There are 1 best solutions below
Related Questions in SWIFT
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Swift code with multiple NSDateFormatter - optimization
- How do I add multiple in app purchases in Swift Spritekit?
- cellForRowAtIndexPath and prepareForSegue return different label colors
- Getting this message in my console in xcode "Ignoring restoreCompletedTransactionsWithApplicationUsername: because already restoring transactions"?
- Change background of an Accessory View in a UITableViewCell
- fade in an bounce animation subview
- Create a PFObject and PFRelation after PFUser Sign Up
- Swift 2 - Pattern matching in "if"
- How do I give inputs through NSURL
- How do I add custom cells to TableView in Swift?
- UIWebView not loading URL in simulator
- Compiler complains that 'Expression resolved to unused function' when removing index in array of functions
- Cast from 'Int?' to unrelated type 'NSNumber' always fails
Related Questions in SKNODE
- How to translate SKPhysicsContact contactPoint into my SKSpriteNode position
- SKLabelNode.name target for setText
- What does @"//" do in childWithName and when to use it
- How to find the speed of SKSpriteNode from 5 frames ago in Swift
- Can I create SpriteKit texture atlas in runtime
- Extend a SKSpriteNode in One direction only
- nested SKNodes in spritekit?
- When subclassing SKNode, should the Frame property return a non-empty value?
- Swift 3 (SpriteKit): Create a texture from a node tree
- Swift optional binding and SKNode.name
- Shooting a projectile in spritekit
- Sprite Kit SKNode Hit Area
- Sprite Kit: How To Subclass SKNode to create a Vehicle class (complex object with joints)
- Why does Sprite Kit SKNode expose zRotation, xScale and yScale instead of simply a transform?
- How to render a SKNode to UIImage
Related Questions in SKEMITTERNODE
- SKEmitterNode particles lag at start
- SKEmitterNode for starfield... sprites are not opaque
- SKEmitterNode Causing Crash on Scene Restart
- Get Nil when retrieving file path form Main Bundle when file is in Copy Bundle
- Change direction of existing particles
- Creating a trail with SKEmitterNode and particles in SpriteKit
- Node's path particle effect with SpriteKit
- spritekit: trouble with particle keyframe sequence
- NSInvalidArgumentException in SpriteKit Swift
- Lighting a SpriteKit SKEmitterNode
- Is it possible to apply a filter on a SKEmitterNode?
- skemitternode not working on IOS9?
- What exactly is SKEmitterNode particleLifetime?
- Detecting when SKEmitterNode particle makes contact with another SKNode
- How do I stop endlessly playing SpriteKit emitter?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
SKEmitterNode can be made to stop emitting after emitting
numParticlesToEmitif that property is set: https://developer.apple.com/documentation/spritekit/skemitternode/1398043-numparticlestoemitI believe that most “explosion” type emitters should already have that property set. However I suspect your problem is that you are adding a new SKEmitterNode each time there is a hit.
You could usee a Boolean
var wasHit = falseto track the hit state.Then when the hit occurs, check
wasHitbefore adding the emitter, and then setwasHitto true.