def spawn(self, obj: GameObject, xy = None) -> int: """Spawn a game object.""" self.game_objects[obj._id] = obj if xy is not None: obj.rect = obj.img.get_rect( center = xy ) self.screen.blit(obj.img, obj.rect)