AI FOR MY GAME ???

I want to make an AI that goes to one direction and then to other but it gets to location that i gave it to go ?and also i want to make enemies shoot at my base at random times !!! the player and enemies can just go left right up and down
i wanted it that way :smiley: !if you understand me … I am making a game like TD/RTS/FPS it is TD but you can control the tank on the screen and shoot the enemies and you get money and you can make towers that shoot to … in multiplayer you will attack other players and see who will survive …
SCREEN SHOT SO FAR
[spoiler]

[/spoiler]

so does anyone know how can i make that kind of AI ???

Ok, I dont know what u want with walking leftrightupdown, but for shooting at random times, I would do this:

int randomShot = (int) (Math.random()*(Math.random()*20));
if(randomShot == 0){
shootThisBaby();
}

Math.random()*20 is the amount of possibilities, so if that is 10, randomShot can be 0,1,2 - 9… So it has 10% chance to shoot.

when i said right left up down i meant that it the game is tile based example you move right that is so you are pressing
the letter D and if you press W (i mean up) you will go up and if you press the both you will right or down you cant go in between if you understand me but is just for the player enemies cant go in between also but you cant control them ???

Random directions:

int direction = (int) (Math.random() *4);
Mob.changeDirection(direction);

In Mob(enemy)
public final int left = 0, right = 1, down = 2, up = 3;
public void changeDirection(int dir){
switch(dir)
case left:
xBlock++;
case right:
xBlock–; //etc.
}

but i need it to go at block location 10 in x and 6 in y and that it goes in random locations 20 an 12 are the max x , y

I dont know what you mean, however

if(x==20 && (direction == left || direction == right) ) direction = down;
Watch some tutorials on youtube or so…
Learn to think, I don’t want now to get this reaction: “NOW IT GOES ALWAYS DOWN”, previous reply I told u how to do random things… :wink: Good luck

i was thinking the same thing but i dont want it that way but thanks :smiley: :smiley: