Post

Replies

Boosts

Views

Activity

Why is Add Emitter to Node not happening immediately?
Why is Add Emitter to Node not happening immediately? Within an extension to GameViewController I have: func addEmitterToNode(_ particleName: String, _ theNode:SKSpriteNode) { if let emitter = SKEmitterNode(fileNamed: particleName) { emitter.name = "emitter" emitter.position = CGPoint(x: 0, y: 0) // = at center theNode.addChild(emitter) } } // addEmitterToNode Here is the func (extension to GameViewController) wherein I call the above. The problem is the explosion sound plays but the smoke particle emitter is not immediately added. func increaseSpeed() { if thisSpeed > maxSpeed { pauseGame() // sets myTrain.isPaused = true playSound(theSoundName: "explosion") addEmitterToNode("smokeParticle.sks", myTrain) trainHasCrashed = true } } // increaseSpeed What I do not understand is that the following within GameScene's sceneDidLoad, the smoke particle emitter is added = override func sceneDidLoad() { if itsGameViewController.trainHasCrashed { itsGameViewController.addEmitterToNode("smokeParticle.sks", myTrain) } }
4
0
753
Jul ’24
How do I set the *static* position of a `SKSpriteNode` so that it tilts toward the `UIBezierPath` as if it were following this Path?
How do I set the static position of a SKSpriteNode so that it tilts toward the UIBezierPath as if it were following this Path? When I first start my App, these Nodes are all aligned in a straight line When I call: var trainAction = SKAction.follow(trainPath.cgPath, asOffset: false, orientToPath: true, speed: thisSpeed) for moving the train, the train + each car will orient its tilt to hug the trainPath. But I want the identical tilt to hug the trainPath for its initial static presentation. How do I do that?
0
0
855
Aug ’24
Using Swift, how do I resize individual SKSpriteNodes for various iPad device sizes?
Using Swift, how do I resize individual SKSpriteNodes for various iPad device sizes? Currently, I use theScene.scaleMode = .resizeFill for scaling the entire SKScene and it works as advertised. Please note that .aspectFill does not solve the challenge described below. My challenge is to resize individual SKSpriteNodes (that are components of the overall SKScene) based on size of the iOS device; for example, iPad Mini <--> iPad Pro Right now, I hard code the sizes of these Nodes. But I realize this is not the optimum approach. Again, hard coding is frowned upon. So I am looking for a more dynamic method that functions based on device size.
0
0
571
Oct ’24
External soundbar not playing nice with TV
Apple TV Samsung TV SONOS Soundbar + S1 stereo speakers Apple TV Preferences Sound output = SONOS soundbar Samsung Preferences Sound Output = SONOS HDMI eArc soundbar start with Apple TV movies and as I switch from movie to movie, sound comes out stereo as it should however when I switch to Netflix or YouTube TV with stereo content, sound comes out mono .. until I manually change the ATV Preferences to stereo. As ong as I stay with Netflix content, stereo output. But change to YouRube TV or ATV, it automatically changes to mono. ?????
2
0
188
Feb ’25