INNER CODE UNIT · Python

draw

metafy-social/python-scripts · scripts/Brick-Breaker-Python/main.py:28

    def draw(self, win):
        pygame.draw.rect(
            win, self.color, (self.x, self.y, self.width, self.height))

    def move(self, direction=1):
        self.x = self.x + self.VEL * direction


class Ball:
    VEL = 5

    def __init__(self, x, y, radius, color):
        self.x = x
        self.y = y
        self.radius = radius
        self.color = color
        self.x_vel = 0
        self.y_vel = -self.VEL

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…