Apple Game Frameworks and Technologies:(page 50)

On Chapter 2. Adding Animation and Movement with Actions • 50
the distance is calculated using the Hypotenuse.

let distance = hypot(pos.x - player.position.x, pos.y - player.position.y)

However since the movement is locked to left and right, this does not give a constant speed. This can be verified by touching the top of the screen very near the player in the horizontal plane, The distance will be calculated much larger than the actual movement and the player will appear to walk slow.

I believe for this part of the book an explanation is needed or the helper function should change to:

let distance = abs(pos.x - player.position.x)