Skip to main content

A simple Pygame utility for rectangle-circle collision detection.

Project description

collide_circle

A simple Pygame utility for detecting collisions between rectangles and circles.

📦 Installation

Install from PyPI (after publishing):

pip install collide_circle





#Or install locally (from source):
pip install .




#Usage

import pygame
from collide_circle import rect_collides_with_circle

# Example Pygame setup
rect = pygame.Rect(100, 100, 80, 60)
circle_center = (150, 120)
circle_radius = 40

if rect_collides_with_circle(rect, circle_center, circle_radius):
    print("Collision detected!")


#Function

rect_collides_with_circle(rect, circle_center, circle_radius)




from collide_circle_package import circle_collides_with_circle

# Define two circles
circle1 = (100, 100, 30)  # x, y, radius
circle2 = (130, 100, 20)

# Check for collision
if circle_collides_with_circle(*circle1, *circle2):
    print("Circles are colliding!")
else:
    print("Circles are not colliding.")

#function

circle_collides_with_circle(x1, y1, r1, x2, y2, r2) -> bool

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collide_circle-0.1.3.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

collide_circle-0.1.3-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file collide_circle-0.1.3.tar.gz.

File metadata

  • Download URL: collide_circle-0.1.3.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for collide_circle-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ed6eaac834952fc4aac3b8a3e1e4a7543ffb1808b45e2f31ec59a6af32abd2a2
MD5 c5ddf2c8ca2d1212da15a2b130db210e
BLAKE2b-256 cdff48840fa27e1281750c754fe3c3c438a48c5155ded233caa7dac915aa3144

See more details on using hashes here.

File details

Details for the file collide_circle-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: collide_circle-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for collide_circle-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a41f49a0c9fa2104e273b329776fc0abceadc47846e0614c3fe5be1ab71fd50c
MD5 eb1bbb1a421e14971e72c1c30ac3e103
BLAKE2b-256 278b476592a3e2004ede3cd6f6a28df8e38b320340fc7ca8137ce27d8a54e3bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page