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
Oct 20, 2014

Oct 16, 2014

Oct 9, 2014

Oct 8, 2014

Oct 7, 2014

Oct 4, 2014

Oct 1, 2014

Sep 19, 2014

Sep 17, 2014

Sep 9, 2014

Sep 8, 2014

Sep 7, 2014

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