def __init__(self, x_pos, y_pos): """ Initializes an EmptyCone object x_pos: the starting x-position of the cone y_pos: the starting y-position of the cone """ Graphic.__init__(self) self.image, self.rect = load_image(os.path.join('assets', 'img', 'cone.png'), -1) self.rect.x = x_pos self.rect.y = y_pos
def __init__(self, x_pos, y_pos): """ Initializes an IceCreamCone object scale: an int used to scale the width and height to control the size x_pos: the starting x-position of the cone y_pos: the starting y-position of the cone """ Graphic.__init__(self) # Initialize our velocities to zero self.x_velocity = 0 self.y_velocity = 0 # Create a new sprite group to handle drawing all our sprites self.sprite_group = pygame.sprite.OrderedUpdates() # Create a new empty cone and add it to our sprite group self.cone = EmptyCone(x_pos, y_pos) self.sprite_group.add(self.cone) # Create a new list to keep track of the scoops on the cone self.scoops = list()
def __init__(self, x_pos, y_pos, kind=None): """ Initializes a new Scoop object at the given position and scale. rect.x: int - the x-coordinate of the top-left corner rect.y: int - the y-coordinate of the top-left corner """ Graphic.__init__(self) types_of_cream = [ 'mint.png', 'scoop-white.png', 'pink.png', 'choc.png' ] if kind is None: self.kind = random.choice(types_of_cream) else: self.kind = kind self.image, self.rect = load_image( os.path.join('assets', 'img', 'scoops', self.kind), -1) self.rect.x = x_pos self.rect.y = y_pos
def __init__(self, y_velocity, max_wind_speed): Graphic.__init__(self) self.x_velocity = 0 self.y_velocity = y_velocity self.max_wind_speed = max_wind_speed