Whats a way to write AI for the pacman ghosts? In my game there's three ghosts. Also, how would I get the ghosts to react to the super pill?
Here's my attemp at ai:
Code:
struct ghost {
// BITMAP* sprites[4];
int sprNum;
unsigned int points;
int oldx;
int oldy;
int x;
int y;
};
struct ghost ghost1, ghost2, ghost3;
void movecomputer(void)
{
ghost1.oldy = ghost1.y;
ghost1.oldx = ghost1.x;
if(ghost1.y >0)
ghost1.y--;
else if(ghost1.y < 14)
ghost1.y++;
level[ghost1.oldy][ghost1.oldx] = 0;
level[ghost1.y][ghost1.x] = 5;
}