A motion control system is designed for the biped robot walking up and down a slope. Firstly, model of robot walking on slope is present and kinematics equations of that motion are proposed. Secondly, the trajectories of foot and hip are parameterized, and other trajectories of joints are computed by the geometrical relationship when the robot executing those motions. Thirdly, a new improved particle swarm optimization is introduced to optimize the motion of robot under the constraint of dynamic movement in complex environment. The whole motion is controlled through two fuzzy logic controllers whose rules are optimized by improved particle swarm present in this paper off-line. Finally, experiments show the efficiency of the method in the paper.