I wonder how to make a game with artificial intelligence. I would like to be able to do to paddle on the right side of herself chased by flying ball.
Sorry for my english
Capx click on 'sciagnij plik' to download
ok.. i have done it like this.
create an invisible area from the middle to end right or left side, depends on which side you have the ai.
when ball is overlapping the invisible area set enemy "lerp(Enemy.Y, Ball.Y,0.1)"
that will make the enemy follow the ball inside this area. the last bit "0.1" is how fast the enemy will respond on the ball(time), if im correctly.
the only thing i haven't found out yet is how to make the enemy collide with a wall and not go through, because when you lerp an opject then it just ignore everything else.
Develop games in your browser. Powerful, performant & highly capable.
"lerp(Enemy.Y, Ball.Y,0.1)" what does mean 'lerp' ??
Explanation of Lerp
<img src="smileys/smiley2.gif" border="0" align="middle">
Hmmmm I'm not sure I follow you... What do you mean by that?
i set y of enemy lerp(Enemy.Y, Ball.Y,0.1)
enemy paddle dont move.
that is my modified version of your capx, i have put a comment inside the event sheet.
tell me if you need further help ;)
i hope it explains.
thats amazing pal :) how i can minimal slow down the enemy paddle? (its too fast and he always win ;))
try to edit the time "0.1" and set it to something else..
between 0.1 and 1 that should slow it down
well paddle is still moving fast but YOU HELPED ME A LOT !!! :)) THANKS:)
Make the 0.1 something like 0.05 or 0.02 or something ;)
please get me a favor, re post in mediafire mediafire.com/error.php the pong example, i need learn the AI for my 2 playyer in my game pong. please.