stuck with AI on "light bike" type game mostly clone x y
Posted: Thu May 28, 2009 11:33 pm
this is pretty confusing so read slow
so i'm making a "light bike" type game and im trying to make the enmy avoid your "dots"
i have the enemt moving random pretty good, but i want to make him some what smart.
FYI #1: the move(); function is random movement, except for he wont travel the opposite way he came from and cause certain death
FYI #2: the object of the game is to get the enemy to run into your dot trail while avoiding there's.
so when i create the actor dot it has a timer of 1 second. on the timer i have this code
to hold the position of all the dots and to make it so you can only get them with recently created dots
then on draw actor for the enemy i have this
to move if he is within 25 pixles of any of the cloned dot positions.
for some reason though the enemy runs straight into the wall.........
i can show some one the ged, but i'm not gonna post it since the codes messed up i don't want anyone trying to use it i guess....
so i'm making a "light bike" type game and im trying to make the enmy avoid your "dots"
i have the enemt moving random pretty good, but i want to make him some what smart.
FYI #1: the move(); function is random movement, except for he wont travel the opposite way he came from and cause certain death
FYI #2: the object of the game is to get the enemy to run into your dot trail while avoiding there's.
so when i create the actor dot it has a timer of 1 second. on the timer i have this code
- Code: Select all
x2[cloneindex] = x;
y2[cloneindex] = y;
to hold the position of all the dots and to make it so you can only get them with recently created dots
then on draw actor for the enemy i have this
- Code: Select all
for(i = 0; i < 1000; i++)
{
if(distance(x, y, x2[i], y2[i]) <= 25)
{
move();
}
}
to move if he is within 25 pixles of any of the cloned dot positions.
for some reason though the enemy runs straight into the wall.........
i can show some one the ged, but i'm not gonna post it since the codes messed up i don't want anyone trying to use it i guess....