Choppy enemy movement

I had a question about How to calculate the enemy to arrive in the middle of cell.

How to calculate the enemy to arrive in the middle of cell?

The posters pointed out that the direction of the enemy isn't needed because the velocity already has a direction. I modified the code -

if(position.x < start.position.x) {
velocity.x = ENEMY_VELOCITY;
}
else if(position.x > start.position.x){
velocity.x = -ENEMY_VELOCITY;
}
else {
velocity.x = 0;
}

if(position.y < start.position.y) {
velocity.y = ENEMY_VELOCITY;
}
else if(position.y > start.position.y){
velocity.y = -ENEMY_VELOCITY;
}
else {
velocity.y = 0;
}
position.add(velocity.x * deltaTime, velocity.y * deltaTime);

The enemy's movements were choppy after it go around the tower I added the range of the middle of a cell but it looks like it'll stop in certain places.

public void plotPath(Cell start, float deltaTime) {

if(position.x < start.position.x && Math.abs((start.position.x - position.x)) > 0.01f) {
velocity.x = ENEMY_VELOCITY;
}
else if(position.x > start.position.x && Math.abs((position.x - start.position.x)) > 0.01f){
velocity.x = -ENEMY_VELOCITY;
}
else {
velocity.x = 0;
}

if(position.y < start.position.y && Math.abs((start.position.x - position.x)) > 0.01f) {
velocity.y = ENEMY_VELOCITY;
}
else if(position.y > start.position.y && Math.abs((position.y - start.position.y)) > 0.01f){
velocity.y = -ENEMY_VELOCITY;
}
else {
velocity.y = 0;
}
position.add(velocity.x * deltaTime, velocity.y * deltaTime);
}

I think Math.abs((position.y - start.position.y)) is a wrong way to calculate. I tried to fix 0.1f to different value, but it'll stop somewhere after passing the tower or having choppy movements, it's much less than before.

-
What exactly do you mean by "choppy"? Is it swinging wider than you wanted it to? or, too many corners? If you want the course to be smoother, reduce deltaTime. But this of course will slow your whole game down, unless you run through this whole calculation more often. – Paul Z Jun 5 '11 at 15:01
the enemy isn't reaching the center of a cell, so it'll zig zag between the middle of a cell. I tried to expand the middle of a cell but it seems it's not working. – Tashu Jun 5 '11 at 15:38
I'm thinking to go back where I posted first to get the distance == 0 by changing velocity somehow. – Tashu Jun 5 '11 at 15:39