Replacement or cooperation of humanoid robots with human beings is the goal of constructing these robots. Human environments are dynamic, indefinite and noisy. In this respect, humanoid robots should have the ability to perform flexible and dynamic motions. In this study, kicking is investigated as a typical humanoid robot’s motion. Kicking is considered a leading skill in robotic soccer competitions. These days the majority of soccer playing robot teams employ a kind of kicking which is based on fixed keyframes. These kicks are executed with direct angle and fixed distance. In order to kick directly, the robot should stand behind the ball in an exactly straight way towards the goal. The needed time in which a robot arranges its direction toward the goal is called the preparation time. If this time is reduced, the likely intrusion of opponent robot and the probability of losing the ball will be reduced. The capability of kicking with controlled angle and distance decreases the preparation time due to the fact that robot needs to change its direction behind the ball less than before. In addition, this ability provides the feasibility of passing and team cooperation. The objective is implementing a kick with controlled angle and distance in a way that robot moves the ball towards favorable directions and distances. Using machine learning in order to create keyframes in real time mode is the represented approach. Base kick is designed through applying fixed keyframe method. Next, the joints that affect the angle and distance of the ball are chosen. Changing the value of these joints, the covariance matrix adaptation evolutionary strategy produces kicks with various angles and distances. The relation between changes of joints and changes in angles and distances of kick is non-linear. This relation is estimated by a two layered feedforward artificial neural network. While the favorable angle and distance of kick serve as input, values of joints are outputs. On the request of a kick with certain angle and distance, the trained network produces the values of joints and then the kick operates. The results prove the reliability of the employed method. This method is implemented through simulated soccer robot. The robot is capable of kicking with diverse angles and distances in a continuum of -90 to +90 degree and a range of 2 to 7 meter. Keywords: Humanoid robot, Covariance matrix adaptation evolutionary strategy, artificial network, 3D soccer simulation