'Action after Mario has bumped the box from below'

def bumped(self):

    self.rect.y += self.y_vel
    self.y_vel += self.gravity
    if (self.rect.y > (self.rest_height + 5)):
        self.rect.y = self.rest_height
        self.state = c.OPENED
        if (self.contents == 'mushroom'):
            self.group.add(powerups.Mushroom(self.rect.centerx, self.rect.y))
        elif (self.contents == 'fireflower'):
            self.group.add(powerups.FireFlower(self.rect.centerx, self.rect.y))
        elif (self.contents == '1up_mushroom'):
            self.group.add(powerups.LifeMushroom(self.rect.centerx, self.rect.y))
    self.frame_index = 3
    self.image = self.frames[self.frame_index]
