pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
InCircle

InCircle - 1.0

Ryan Baumann (theguywhogoton)

Tags:

Description

I noticed PyGame has no way in checking if a point is inside a circle or any distance function. I then created this, you can just import it (If you download the pyc file and place it in the folder of your game). distance(p1, p2) - Returns an integer check(dis, rad) - Returns a boolean Example: http://PhoenixProgramming.org/files/InCircleExample.py

Links

Home Page: http://www.pygame.org/
Source: http://PhoenixProgramming.org/files/incircle.py
Windows: http://PhoenixProgramming.org/files/incircle.pyc
Mac: http://PhoenixProgramming.org/files/incircle.pyc

Releases

InCircle - 1.0 - Jan 25, 2009

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

June 18, 2009 9:39pm - Ryan Baumann - nickname: (theguywhogoton)
@effeemme: math.hypot...I'm not too sure how that works, I don't believe my distance function would be slower.

@algorias: Yes but there is no way of checking if a point is inside a circle. This could be useful for example checking if a rectangle is inside a circle or any other shape for that matter.
January 25, 2009 11:10am - Vitor Bosshard - nickname: (algorias)
The sprite module already supports collision checks using circles instead of rects.
January 25, 2009 10:23am - Francesco Mastellone - nickname: (effeemme)
Err, how about math.hypot?
spotlight

 
our projects
pygame.org 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)