Pong AI
How to make AI for pong game. I have a paddle and a ball.I used an integer attribute to save X postion of ball. And then used change attribute to change the x position of the paddle to X position of ball.However nothing happens
Best Answer
-
jn2002dk Posts: 102
Instead of changing the x position of the paddle you should set the linear velocity to move towards the ball
For instance
If x of the paddle is smaller than x of the ball set velocity to 10, if x is larger set velocity to -10
Answers