'Deals with Mario if he hits a shell moving on the x axis'

def adjust_mario_for_x_shell_collisions(self, shell):

    if (shell.state == c.JUMPED_ON):
        if (self.mario.rect.x < shell.rect.x):
            self.game_info[c.SCORE] += 400
            self.moving_score_list.append(score.Score((shell.rect.centerx - self.viewport.x), shell.rect.y, 400))
            self.mario.rect.right = shell.rect.left
            shell.direction = c.RIGHT
            shell.x_vel = 5
            shell.rect.x += 5
        else:
            self.mario.rect.left = shell.rect.right
            shell.direction = c.LEFT
            shell.x_vel = (-5)
            shell.rect.x += (-5)
        shell.state = c.SHELL_SLIDE
    elif (shell.state == c.SHELL_SLIDE):
        if (self.mario.big and (not self.mario.invincible)):
            self.mario.state = c.BIG_TO_SMALL
        elif self.mario.invincible:
            self.game_info[c.SCORE] += 200
            self.moving_score_list.append(score.Score((shell.rect.right - self.viewport.x), shell.rect.y, 200))
            shell.kill()
            self.sprites_about_to_die_group.add(shell)
            shell.start_death_jump(c.RIGHT)
        elif ((not self.mario.hurt_invincible) and (not self.mario.invincible)):
            self.state = c.FROZEN
            self.mario.start_death_jump(self.game_info)
