Diego Esc Diego Esc - 5 months ago 49
Swift Question

Add nodes where touches began

I´m making a game with Swift.
I need to add nodes where I press the screen, I know this is not from other planet but I can't do it.


Highly simplified example could look like this:

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    guard let touch = touches.first else { return }
    let location = touch.location(in: self)
    let node = SKNode()
    node.position = location