''' This file defines the Block and Obstacle classes. ''' import pygame class Block(pygame.sprite.Sprite): def __init__(self, x, y, size): super().__init__() self.image = pygame.Surface((size, size)) self.image.fill((0, 0, 0)) self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y self.speed_y = 0 def update(self, gravity): self.speed_y += gravity self.rect.y += self.speed_y class Obstacle(pygame.sprite.Sprite): def __init__(self, x, y, width, height): super().__init__() self.image = pygame.Surface((width, height)) self.image.fill((0, 0, 0)) self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y def update(self, speed): self.rect.x -= speed