Do this (screenshot). Shown is only moving up, but the other directions will be similar. For other sprite directions, replace the 508,509,510, and 511with the correct sprite number and either inc/dec x or y depending on the direction of movement.