Hi All. I have managed to create the Classic Ping Pong game using VisualC# Windows Form as a base plate. I have been looking around for help with an A.I player ( Computer. ) So 2 people dont have to share 1 key board. First a thought Tracking the balls Position with the right paddle,( Computer's Bat ) but as the X, and Y position of the moving ball changes every 1/60 of a second, I found it hard to code. Forgive me but like others here, I also are quite new to this. I did thing on the lines of :
if.(MainBall.location Y > ComputerBat.Height )
then.ComputerBat.location.Y + >.Height;
That would if it worked, move the computer Bat up inline with the Ball. Same would go for if the Ball was lower than bat height. But as the Ball only has an X, and Y position to start from ( the center when game first starts. ) I am stuck. Anyone PLEASE help...
I know it's not really an A.I programme , Just the tracking of the ball with a bat. As i have said, im quite new to it all, but you have to start somewhere.
I have the game up and running as a 2 player, with scores and a good background screen, Start window, and message boxes if you scrore more than 20 points, I just think adding a 1 player against the computer would make it more interesting.
I would change the comp bat speed to give the player a chance and when the ball moves away from the bat, The bat would return to Height /2 ( half way up. )