pygame is
Simple DirectMedia Layer is
Site Swing



Get the distance between two (x,y) format locations using the Pythagorean theorem

In a right triangle, (x1-x2) being the horizontal distance between the two points (The change in x) and (y1-y2) being the vertical distance between the two points (The change in y),

(x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) == distance*distance. So the distance is the square root of (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2).

dist = math.sqrt((x1-x2)**2 + (y1-y2)**2))

You can also used the math function hypot:

dist = math.hypot(x1-x2, y1-y2)

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Apr 19, 2014

Apr 16, 2014

Apr 13, 2014

Apr 9, 2014

Mar 18, 2014

Mar 15, 2014

Mar 14, 2014

Mar 13, 2014

Mar 11, 2014

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)