Just some quick thoughts.
Remove the keydown checks in the loop. No need to check them again.
Must agility always be greater or equal to zero? Otherwise you could let key left make agility < 0, and then in the loop just have .X + agility
If not, you could have a private the_direction variable that you set to 1 or -1 depending on if you press left or right arrow key, and then in the loop use it as so: .X + (agility * the_direction)