For smooth movement, i would recommend using ATAN, SIN and COS, since increasing/decreasing X and Y by conditional statements would produce an odd movement. Here's a sample code.