This seems so simple but my searching as failed to find a good result.
The idea is that you can move in 360 degrees but you aren't faster when you move in a diagonal direction. I know how to do this with trig. The problem is I I want some physics so that if you are traveling north and start traveling south you first need to slow down to zero to go south. (And if going 270 deg to 30 deg it would be a more complicated.) The character has acceleration and a max speed.
I know that vectors are the solution but I can't find how to apply them the current speed to get smooth movement.
I'm doing this in GameMaker Studio 2, but pseudocode should suffice. Here's what I have.
var h,v; h = key_to_axis(vk_right,vk_left); v = key_to_axis(vk_down,vk_up); var dir = point_direction(0,0,h,v) spd = approach(spd,max_spd,accel); x+= lengthdir_x(max_spd,dir); y+= lengthdir_y(max_spd,dir);
Note that this movement is shared by characters that can move in the full 360 degrees.