Post

Replies

Boosts

Views

Activity

Reply to How can I have an SKSpriteNode follow the same path back and forth?
Actually someone gave me an easier answer on StackOverflow. This is a quote from the link below There is a method called reversed() which you could use. Below I have given your action a name of "youraction" let youraction = SKAction.follow(iconPath0, asOffset: false, orientToPath: false, duration: 1) let reverseaction = SKAction.reversed(youraction) yourspritenode.run(reverseaction) Alternatively, you can just use reversed after the action name to run it in reverse: yourspritenode.run(youraction.reversed()) https://stackoverflow.com/questions/66354936/how-can-i-have-an-skspritenode-follow-the-same-path-back-and-forth/66357189#66357189
Mar ’21
Reply to Having strange trouble with touchesMoved, need help.
I cannot access the URL, (after removing the spaces) All of a sudden FileZilla won't properly transfer images at all (yes, set to binary). Looking for a new FTP. Have added super. to all my touches (as seen below) and it still happens     override func touchesMoved(_ touches: SetUITouch, with event: UIEvent?){         super.touchesMoved(touches , with:event)         guard touches.first != nil else { return }         if toggleHigh {highliteGem(theGem: myGems[0], clearAll: true)}         if let touch = touches.first, let node = myGV.currentGem, node.isMoving == true {             let touchLocation = touch.location(in: self)             node.moved    = true             print(touchLocation)             node.position = touchLocation             node.isMoving = true             node.inSlot = false             //addTrailToTwinkle(theNode: node)         }     }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Having strange trouble with touchesMoved, need help.
In which class is this ? ie, what is self ? GameScene toggleHigh, line 10, isMoving That's misc, and a copy error. All the other code be removed and it's the same thing what is the result of the print ? Is it what you expect ? No it's not, that's the problem. So if I move the gemBase, which is its own class) to the right by let's say 100. Then the print result is 100 more than where I'm touching on the screen. That's why I wondered this is due to the gem being owned by the gemBase.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Having strange trouble with touchesMoved, need help.
I got the answer over at Stack overflow, https://stackoverflow.com/questions/67511055/having-a-strange-trouble-with-touchesmoved-position-doesnt-match-location-wher?noredirect=1#comment119406263_67511055 Someone took the time to recreate my issue and had me change: let touchLocation = touch.location(in: self)  to let touchLocation = touch.location(in: gemBase) Of course that leads me to another question, but I'll start another thread for that.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to How can I access an array in one of my classes?
I cannot access the screenshot. I wish I knew what was up with my server, sorry myGV is a structure to hold a few global variables. myGV.guessBar = GuessBar : SKSpriteNode The GuessBar has 6 children, GuessSlot : SKSpriteNode. GuessBar has an array that has all six instances of them. Here is the code for GuessBar: class GuessBar : SKSpriteNode{     var guessSlots : [GuessSlot] = []     init(color: SKColor, size: CGSize) {        super.init(texture: nil, color: color, size: size)     }     required init?(coder aDecoder: NSCoder) {         fatalError("init(coder:) has not been implemented")     }  } Here is the code where I fill the arrays in the guessBar func createGuessBar(color: SKColor, size: CGSize, factor: Int) -> GuessBar {     let myGuessBar = GuessBar(color : color, size: size) //other unrelated code     for x in 0...5{         let mGuessSlot = GuessSlot(color: .clear, size: CGSize(width: iFactor, height: rFactor), width: myGuessBar.size.width,  iFactor: x, guessBarRef: myGuessBar)         myGuessBar.guessSlots.append(mGuessSlot)     } //other unrelated code     return myGuessBar } So the exact info from the debugger reads: myGV.guessBar = (SKSpriteNode?) 0x0000600001984580 *SpriteKit.SKSpriteNode (SKSpriteNode) *guessSlots ([GuessAgain.GuessSlot]) 6 values myGV.guessBar.guessSlots = Invalid Expression The way I see it, everything is running fine. If I expand the guessSlots in the debugger it lists each value. I just can't get the syntax right, going by the last line in the debugger, to access that array from my main structure myGV.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21