Action Will Not Run The Second Time Method is called

In my method moveSun() it successfully rotates and plays the sound the first time it is called. However, subsequent calls to the method only play the sound and do not execute the rotate action. Does anyone know what may be causing this? Here's the relevant code:

func moveSun() 
{
        print(sunMoving)
        let rotateAction = SKAction.rotate(toAngle: 2 * CGFloat.pi, duration: 2)
        let playGearSound = SKAction.playSoundFileNamed("spinningGear", waitForCompletion: true)
        let rotateAndPlayGearSound = SKAction.group([rotateAction, playGearSound])
        
        sun.run(rotateAndPlayGearSound, completion: { self.sunMoving = false; print("completed completion handler") })
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) 
    {
        for t in touches
        {
            self.touchDown(atPoint: t.location(in: self))
        }
    }

func touchDown(atPoint pos : CGPoint)
    {
        let touchedNodes = nodes(at: pos)
        
        for touchedNode in touchedNodes
        {
            print("touchNode: \(String(describing: touchedNode.name))")
            
            if touchedNode.name == "sun" && !sunMoving
            {
                sunMoving = true
                moveSun()
            }
        }
    }
Answered by dlent in 790941022

Disregard. I figured it out. After rotating the first time, the sun was at the angle it was supposed to rotate to the next time it was called. Thus, the action won't do anything if it is already at the desired angle.

Accepted Answer

Disregard. I figured it out. After rotating the first time, the sun was at the angle it was supposed to rotate to the next time it was called. Thus, the action won't do anything if it is already at the desired angle.

Action Will Not Run The Second Time Method is called
 
 
Q