I am creating a recreation pong but I don't know how to make a computer player while i play. I know how to make the ball bounce off the paddles but i want to know how to tell the right paddle it is a computer player.
Offline
You can't just tell the right paddle it's a computer player - you have to program the artificial intelligence. There are many different types of AI you could make for it - I could make a demo, if you want, but I'm not sure what kind you would want.
Offline
riccomario96 wrote:
I am creating a recreation pong but I don't know how to make a computer player while i play. I know how to make the ball bounce off the paddles but i want to know how to tell the right paddle it is a computer player.
In motion click if on edge bounce
Offline
GrammaticlyCorrect wrote:
You can't just tell the right paddle it's a computer player - you have to program the artificial intelligence. There are many different types of AI you could make for it - I could make a demo, if you want, but I'm not sure what kind you would want.
Just a simple pong playing field. Thats all. How do you program the artificial intelligence?
<when[ ]key pressed><forever><go to[ <move( )steps> ?
Offline
Try this formula. Add it to the new sprite.
When [green flag] clicked
Set CPU Level (you must make a variable) to 3
Forever
Repeat until x-position of (Paddle 2 [you must make a sprite in any case], CPU, etc.)= x-position of ball
If x-position of (Paddle 2, CPU, etc.)< x-position of ball
Change x by CPU Level
If x-position of (Paddle 2, CPU, etc.)> x-position of ball
Change x by CPU Level *-1
Offline