Page 1 of 1

Need help for Pong AI (classic style version)

PostPosted: Wed Oct 18, 2006 8:46 pm
by Game_over
Yeah so my basic logic of doing AI for the cpu_paddle is to make it move towards the ball staying only in the y axis. Is this a good idea and if so what script should use or what other way can I go about it. I got everything done but the cpu_paddle so please help.

thanks in advance.

PostPosted: Wed Oct 18, 2006 10:33 pm
by makslane
You can try some thing like this, in the 'Draw Actor' event of the cpu_paddle actor:

Code: Select all
x = (ball.x + x*4)/5.0;

...

PostPosted: Thu Oct 19, 2006 6:43 pm
by Game_over
This is what I am going for

here

Image

PostPosted: Thu Oct 19, 2006 11:38 pm
by Game A Gogo
ive already done a game like that, now im waiting for beta testing, maybe i could send you my final .ged file so you can take a look

Sure

PostPosted: Sat Oct 28, 2006 3:21 am
by Game_over
That would be great.

DO A TIMER silly

PostPosted: Sat Oct 28, 2006 4:00 am
by kyensoftware
Use a timer
cpu_paddle>create actor>create timer><REACTION TIME>>Immediate action
cpu_paddle>timer><TIMER HERE>>script action>
Code: Select all
x = ball.x


It should only muve when the timer is fired.
It works well!! 8)

PostPosted: Sat Oct 28, 2006 5:11 pm
by Game A Gogo
yeah, but sometimes teh reaction is choppy, because if tha ball moves too fast, well alll you see is the pallete jumping places to places.

maybe...MOVE TO!!

PostPosted: Sun Oct 29, 2006 7:07 am
by kyensoftware
maybe moveto instead of script action?

PostPosted: Sun Oct 29, 2006 6:38 pm
by Game A Gogo
in draw actor:
Code: Select all
if(ball.x>x)x+=3;
else if(Ball.x<x)x-=3;

that should do it