feat: complete the game
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user