I have two sknodes on the screen. What is the best way to calculate the distance (\'as the crow flies\' type of distance, I don\'t need a vector etc)?
I\'ve had a go
Here's a function that will do it for you. This is from an Apple's Adventure example code:
CGFloat SDistanceBetweenPoints(CGPoint first, CGPoint second) {
return hypotf(second.x - first.x, second.y - first.y);
}
To call this function from your code:
CGFloat distance = SDistanceBetweenPoints(nodeA.position, nodeB.position);