How do I properly get the direction of moving?

Thanks a lot. But I found a class that calculates that (the “calculate direction” one lol)