I am trying to code velocity for a player at some position to move to another position. The velocity will be based off a maximum move speed.

My thought process is to make a ratio then take that ratio and multiply it by the difference between the two points on the x-axis then take the move speed and multiply it to get the final move speed in the y-axis. Repeat for y-axis. The code I have at the moment will not move me at all and I am unsure why.

move_speed is 15. In case you all are wondering.

Code:void Player::update() { if((clock() - Last_Update) > 50) { float ratio = (abs(grapple_x-x_coord)+abs(grapple_y-y_coord))/(abs(grapple_x-x_coord)*abs(grapple_y-y_coord)); x_vel = move_speed*ratio*(grapple_x-x_coord); y_vel = move_speed*ratio*(grapple_y-y_coord); Last_Update = clock(); x_coord += x_vel; y_coord += y_vel; if(x_coord < 0)x_coord = 0; if(x_coord > 960)x_coord = 960; if(y_coord < 0)y_coord = 0; if(y_coord > 704)y_coord = 704; } }