Pong AI

SANDEEP410SANDEEP410 Member Posts: 46
edited June 2012 in Working with GS (Mac)
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

  • jn2002dkjn2002dk Posts: 102
    Accepted Answer
    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

  • EatingMyHatEatingMyHat Member Posts: 1,246
    as a first step, put a couple of debug messages to see if the values are being set correctly.

Sign In or Register to comment.