Post

Replies

Boosts

Views

Activity

Reply to Is there a way to set isPaused = true for a SKSpriteNode and keep its SKEmitterNode child node moving?
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
Jul ’24
Reply to Why is Add Emitter to Node not happening immediately?
Because of the response from the programmer at Reddit, I have even tried this code: func addEmitterToScene(_ particleName: String, _ theScene: SKScene) { if let emitter = SKEmitterNode(fileNamed: particleName) { emitter.name = "emitter" emitter.targetNode = theScene emitter.position = .zero // = at center of theScene theScene.addChild(emitter) } } // addEmitterToScene func removeEmitterFromScene(_ emitterName: String, _ theScene: SKScene) { if let emitterChild = theScene.childNode(withName: emitterName) { emitterChild.removeFromParent() } } // removeEmitterFromScene which I call via: gameScene.addEmitterToScene("smokeParticle", itsScene) when my Node has exceeded the speed limit and: gameScene.removeEmitterFromScene("emitter", itsScene) when I start over by calling my newGame() Same results ...
Jul ’24
Reply to Why is Add Emitter to Node not happening immediately?
Thanks to a heads-up from someone at Reddit's iOS Programming board when he asked if not pausing the SKSpriteNode made the SKEmitterNode childNode to show ... The answer = Yes ... So, apparently, pausing the SKSpriteNode prevents the SKSpriteNode from updating with its SKEmitterNode childNode. I have a override to GameScene's update(_ currentTime: TimeInterval) .. but that won't be called unless the SKSpriteNode is moving. Is there a way to pause the SKSpriteNode and force an update to display the SKEmitterNode? FWIW, I have tried to create the SKEmitterNode first, then pause the SKSpriteNode. In this case, the SKEmitterNode will definitely show, but the SKSpriteNode does not pause. ?????
Jul ’24
Reply to Calling SKAction.follow(..) causes my SKSpriteNode to rotate 90 degrees CW and not stay horizontal as it follows my UIBezierPath?
-- SOLVED -- The MAGIC centers on (a) initializing the animated GIFs for display on the “top” every time there is a newGame() (b) re-creating the animated GIFs with GameScene’s update(..) method. I owe my "sanity" to both @DonMag on StackOverflow and to John at Apple DTS. Two huge Atta-Boys to these blooming geniuses. -- end SOLVED --
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Jul ’24
Reply to How to ensure current SKScene has fully loaded before engaging it with the GamePad Controller?
SUCCESS ... I discovered that when you use a SKTransition whenever calling presentScene just for os(tvOS), that the above OH-OH happens. Again, no such OH-OH for os(iOS) ?? SO .. just eliminate the SKTransition for os(tvOS), and all is good. I'm not particularly happy about ditching the SKTrnsition, but at least now I know the solution. func presentScene(_ theScene: SKScene) { theScene.scaleMode = .resizeFill if let skView = self.view as? SKView { skView.ignoresSiblingOrder = true skView.showsFPS = true skView.showsNodeCount = true #if os(iOS) let theTransition = SKTransition.doorway(withDuration: 2.0) skView.presentScene(theScene, transition: theTransition) #elseif os(tvOS) skView.presentScene(theScene) #endif } } // presentScene
Topic: Community SubTopic: Apple Developers Tags:
Jul ’24
Reply to Calling SKAction.follow(..) causes my SKSpriteNode to rotate 90 degrees CW and not stay horizontal as it follows my UIBezierPath?
The Apple Docs state: If **orientToPath** = true, the node’s **zRotation** property animates so that the node turns to follow the path. If false, the **zRotation** property of the node is unchanged. I have initialized zRotation = 0.0 (no rotation) and to both +1.0 and -1.0 which initializes the train's zRotation accurately. But as soon as motion begins, the train immediately rotates 90 degrees on its own ?? I have been at this for a good 3-ish weeks, with total failure.
Topic: Graphics & Games SubTopic: SpriteKit Tags:
May ’24
Reply to Apple TV won’t connect to my external surround sound speakers
After 3+ months, I talked with Tim from Apple Support Solution = disconnect your soundbar‘s HDMI cable going to the TV’s ARC port and connect it to non-ARC port. RESTART ATV My soundbar‘s Stereo components = sub woofer + surround sound wall speakers emit sound no matter how many different movies I switch between. Reason = ATV has problems with the ARC port connected to anything in the ATV chain (which obviously includes the soundbar).
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’24
Reply to Detecting touching a SKSpriteNode within a touchesBegan event?
HERE is the THE answer ... Make touchesBegan an extension of GameScene, not GameViewController with: extension GameScene { // "if we set isUserInteractionEnabled = false, the Scene will receive touch events" override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { // not needed because addCreditsButton() isn't called // unless we're staring at "GameScene" // if let ourScene = GameScene(fileNamed: "GameScene") { if let touch:UITouch = touches.first { let location = touch.location(in: self) let ourNode:SKNode = atPoint(location) // not ourScene.atPoint(location) // print("location = \(location)") print("ourNode.name = \(ourNode.name!)") if (ourNode.name == "creditsInfo") { showCredits() } } // if let touch:UITouch // } // if let ourScene } // touchesBegan
Topic: Graphics & Games SubTopic: General Tags:
Mar ’24
Reply to Detecting touching a SKSpriteNode within a touchesBegan event?
Strictly speaking this is not the answer, but I present here what the last comment above talks about - but in a much more readable format. Hopefully this will generate some much needed help: override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { if let ourScene = GameScene(fileNamed: "GameScene") { if let touch:UITouch = touches.first { var position = CGPoint() let location = touch.location(in: ourScene) position.x = -roomWidth/2 + location.x position.y = roomHeight/2 - location.y let node:SKNode = ourScene.atPoint(position) if (node.name == "creditsInfo") { showCredits() } } } // if let ourScene } // touchesBegan Please note that with the above touchesBegan, the node.name is not "creditsInfo", but "room" which is the SKSpriteNode immediately below my itsCreditsNode. "room" has zPosition = 0 versus 5 for itsCreditsNode. So, my itsCreditsNode is not seen. Finally, note that my addCrreditsButton(...) presented at the top of this Post will not change
Topic: Graphics & Games SubTopic: General Tags:
Feb ’24
Reply to Detecting touching a SKSpriteNode within a touchesBegan event?
ALMOST THERE (1) change "let" to "var" + (2) add location.x = -roomWidth/2 + location.x & location.y = roomHeight/2 - location.y which together changes the view coordinates of the original location to match the node.location. I know I am on the right track because besides the "horse", I have several buildings and 2 people added directly to the .sks file. An appropriate print("\(node.name)") prints the names of the buildings + people. BUT, this does not work for my itsCreditsNode since this node is programmatically added, versus added to the .sks file. ??
Topic: Graphics & Games SubTopic: General Tags:
Feb ’24
Reply to Detecting touching a SKSpriteNode within a touchesBegan event?
I did check my .zPosition numbers and they were okay. I even set its .zPosition to a crazy 20 - no change. I also checked that node.isHidden = false and it is. So, it appears your statement that location is the culprit. As a matter of interest, physically this "info" SKSpriteNode is physically very close to the top-left corner .. so I clicked very close to this location and got, for example (1.0, 30.0). No matter how precise I tried to get (0.0, 0.0) I could never get that close vertically. So, that truly mystifies me. One last thing: .anchorPoint = (0.5, 0.5) AHAH = it's a circle with radius = 40.0, a left-edge offset from left scene border = 50.0 and a top-edge offset from top scene border = 15.0 That number = 30.0 mentioned above still bugs me greatly.
Topic: Graphics & Games SubTopic: General Tags:
Feb ’24