Every tick you would compare the previous location to the one before it.
global variable "PreviousX"
global variable "PreviousY"
system every tick
->set variable PreviousX to Mouse AbsoluteX
->set variable PreviousY to Mouse AbosluteY
compare system variable PreviousX < Mouse absolute X
-> Sprite Set Frame "3"
compare system variable PreviousX < Mouse absolute X
-> Sprite Set Frame "2"
compare system variable PreviousY < Mouse absolute Y
-> Sprite Set Frame "0"
compare system variable PreviousY > Mouse absolute Y
-> Sprite Set Frame "1"