I am programming a game for practice and I am trying to design a algorithm that finds the x and y vectors that the "bot" will need to follow in order to reach the players exact x and y coordinates. I already used Pythagorean's theorem to find the distance between the bot's coordinates and the player's coordinates. So from here I could easily find all the degrees of the triangle but I have no clue how to convert that into x and y vectors.
as an example if I set the bot to move at vector x = -5 then it would move -5 pixels (left) across the screen every time the monitor refreshes.
I know all x and y positions of the entities at all times.
So is there anyway to just take the degree from one corner of the triangle and convert it into vectors that the bot can move on?
Thanks.
You don't need angles.
If the robot is at $(x_r, y_r)$ and the player is at $(x_p, y_p),$ a vector that goes from the robot's position to the player's position is $(x_{rp}, y_{rp})$ where \begin{align} x_{rp} &= x_p - x_r, \\ y_{rp} &= y_p - y_r. \\ \end{align}
But this has the robot going to the player's position in one step. You will probably want to make the robot travel slower than that, so multiply both of the coordinates of your vector by some small number; for example, if you multiply by $0.05$ (which equals $1/20$) then it will take $20$ steps for the robot to reach the player.