I am making a ping-pong game in 2D just like the Pong for Atari and I would like to know how to make the other player play against me
Comments
tenrdrmerMember, Sous Chef, Senior Sous-ChefPosts: 9,934
I would track the balls position and work out something that changes the paddles velocity to move toward the ball based on the difference in the y positions or something.
Get creative and test different ways. Thats half the fun of making Games.
This a question of how smart you want to make the AI. A simple rule to match the Y position of the ball in player b would probably be too tough to beat unless there was some lag in it or you limited the speed of the paddle. And if you want to it to be progressively hard to beat based on the ability of the play, you have to add a "shandy factor' . This is a the amount of slack in your rules that are adjusted to get tighter as the player gets better and makes it tougher for the player.
You could perhaps up the speed of reaction of the paddle with each volley, or point won by player A, but if you tighten it too much you can make the game unbeatable and that is no fun. So you will have to test it and see how it works and adjust it accordingly.
I hope that helps. I don't have time to work it out at the moment but I am sure there are others on here who have put something like this into practice and could advise you. Just bear in mind that to keep things as simple as possible if you have not had experience of this type of thing, and build up the rules slowly and with the ability to modify them easily.
Comments
Get creative and test different ways. Thats half the fun of making Games.
___________________________________________________________________________________
TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes
You could perhaps up the speed of reaction of the paddle with each volley, or point won by player A, but if you tighten it too much you can make the game unbeatable and that is no fun. So you will have to test it and see how it works and adjust it accordingly.
I hope that helps. I don't have time to work it out at the moment but I am sure there are others on here who have put something like this into practice and could advise you. Just bear in mind that to keep things as simple as possible if you have not had experience of this type of thing, and build up the rules slowly and with the ability to modify them easily.
kipper
kipper
p.s. search in the GS 'New' browser when you open up the editor.