Add a force towards a position... only X axis! how?

If we want to add a force on an object to move it towards a position but only in one axis how can we do it? :confused:

First you have to use actions that lets you add forces in the X axis only, for example with components add a force of (200; 0), or with angle a force of 200 with angle 0.
Now, to move towards a position, you need the direction of the force (the sign), to get it you can do it:

Conditions: Always (No conditions) Actions: Do = sign(TargetPosition.X() - YourObject.X()) to the variable Direction
This way, Direction variable will be 1 if TargetPosition.X() > YourObject.X(), -1 if TargetPosition.X() < YourObject.X() or 0 if the object position is the same as the target.
Finally, add the direction to the force action:

Conditions: Always (No conditions) Actions: Do = sign(TargetPosition.X() - YourObject.X()) to the variable Direction Add to YourObject a force of Variable(Direction)*200 on X and 0 on Y Or: Add to YourObject a force, angle 0 and length Variable(Direction)*200