This repository has been archived on 2019-12-09. You can view files and clone it, but cannot push or open issues or pull requests.
pacman/livrables/1/pacman_sprite.py

13 lines
513 B
Python
Raw Permalink Normal View History

"""Pacman Graphic Object"""
import pygame as pg
class PacmanSprite(pg.sprite.Sprite):
def __init__(self, size):
super().__init__()
self.image = pg.Surface([size, size])
half_size = int(size / 2)
pg.draw.circle(self.image, (255, 255, 0), (half_size, half_size), half_size)
# Fetch the rectangle object that has the dimensions of the image
# Update the position of this object by setting the values of rect.x and rect.y
self.rect = self.image.get_rect()