import pygame as pg class Obstacle(pg.sprite.Sprite): def __init__(self, game, x, y, w, h): self.groups = game.walls pg.sprite.Sprite.__init__(self, self.groups) self.game = game self.rect = pg.Rect(x, y, w, h) self.hit_rect = self.rect self.x = x self.y = y self.rect.x = x self.rect.y = y