se_uebungen/snake/snake_segment.py
2026-04-16 16:48:29 +02:00

24 lines
721 B
Python

import pygame
from game_object import GameObject
class SnakeSegment(GameObject):
def __init__(self, center: tuple|list, radius: float|int, color: tuple) -> None:
self.__center = center
self.__radius = radius
self.__color = color
def draw(self, surface: pygame.Surface) -> None:
pygame.draw.circle(surface=surface,
color=self.__color,
center=self.__center,
radius=self.__radius)
def get_position(self) -> tuple:
return self.__center
def get_radius(self) -> int|float:
return self.__radius
def get_color(self) -> tuple:
return self.__color