feat: complete the game

This commit is contained in:
Stevan Freeborn
2026-05-22 09:34:56 -05:00
parent 6f9672beb5
commit 2ad2dfb6f8
9 changed files with 317 additions and 2 deletions
+28
View File
@@ -0,0 +1,28 @@
from typing import Self
import pygame
class CircleShape(pygame.sprite.Sprite):
containers: tuple[pygame.sprite.Group, ...]
def __init__(self, x: float, y: float, radius: float) -> None:
if hasattr(self, "containers"):
super().__init__(*self.containers)
else:
super().__init__()
self.position: pygame.Vector2 = pygame.Vector2(x, y)
self.velocity = pygame.Vector2(0, 0)
self.radius = radius
def draw(self, screen: pygame.Surface) -> None:
pass
def update(self, dt: float) -> None:
pass
def collides_with(self, other: Self) -> bool:
d = self.position.distance_to(other.position)
r = self.radius + other.radius
return d < r