0

I am trying to make a button that when pressed starts a game. Where it says let pointOfTouch = touch.location(self), I am getting the error message "Cannot call value of non-function type 'CGFloat.'" There is another post regarding this, but I have not found much use from it. Here is my code:

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

    for touch: AnyObject in touches {

        let pointOfTouch = touch.location(self)
        let nodeITapped = atPoint(pointOfTouch)

        if nodeITapped.name == "startGame" {
            startGame()
        }
    }
}
CodeBender
  • 35,668
  • 12
  • 125
  • 132
Aidan
  • 89
  • 1
  • 2
  • 11

1 Answers1

0

You can try

let pointOfTouch = touch.location(in: self)
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87