How To Make Player Move In Top Down Game

I must really be blind because I cannot find anything dealing with this directly in forum, wiki or tutorials. I find info on a stationary player that rotates and shoots at incoming targets, I see the info for projectiles and I see the pathfinding info for enemies but nothing on player control unless you are making a platformer.

I am curious as to how I would set up 8 direction type movement for a top down player that can be operated by designated keys on a keyboard. I want the player to be able to move in any direction via the WASD keys.

Much Thanks

Included with this post is a screenshot of 8 directional player movement using WASD. I’m a bit tired to explain well, but hopefully for now you can read it and see what is going on.

Thanks so much Mat for taking the time to post this. I will study this and learn it. If I cannot find this in Wiki I will try to get in there as well. Thanks again.

Did you manage to get this working?

It’s on my list of video tutorials to make a “how to do 8-directional movement”, since this question is asked very often! But I can explain what I did in the code up there in more detail if you did not get this working yet?

GD has an event template for 4 directional movement. I haven’t used it but you can use the same logic for 8 directional movement(Most of it will be copy paste).

Hey Mats, I don’t know how to upload a screen shot attachment like you have but I did something a little different and it works great.

W key is pressed

Add to player a Force, angle: 270 degrees and length: 0 pixels
Do -2 to the Y position of player
(-2 to the Y is what I had to have to match the speed of a scrolling background set at *1, the X background is set to scroll at *0.75)

There is also a condition set that says if any key (WASD) is not pressed then Stop the Player and this is set to trigger one time.
I also have a timer that controls WASD keys. The diagonal movement is a little quicker when multiple keys are pressed at the same time but it is not extreme and the change is fluid. It will also be beneficial to combat movement in my game so I am leaving it as is.