Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Milese3

macrumors 6502
Original poster
Hi, I would like to know how I can use the TouchesMoved function in Swift to draw an SKTexture (in my case, a ladder texture) where the user drew.

King regards, Miles.
 
Hey,

Something like this should work?

Code:
override func touchesMoved(touches: NSSet, withEvent event: UIEvent)
    {
        for touch: AnyObject in touches
        {
            let location = touch.locationInNode(self)
            drawMyAwesomeLadder(location)
        }
    }
      
func drawMyAwesomeLadder(location : CGPoint)
{
          var newNode = SKSpriteNode(texture: SKTexture(imageNamed: "ladder"))
        newNode.position = location
        view.addChild(newNode) // view here is your SKView
}

Oops, it was 4 days ago, I suppose you solved it already. 🙂
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.