For what do you want to use the velocity?

In your game you don't have the usual units that we use in "every-day-physics". That means instead of meters you have pixels as a measurement of length and instead of seconds you probably have simulation ticks (unless you use delta time, then you really have seconds or milliseconds). In the end you can convert pixels into real-world-meters by knowing how dense the display is and you can convert simulation ticks into real-world-seconds by knowing how fast your game loop is running.

If you want the velocity in

*pixels per simulation-tick* you can simply take the ammount you move ('d' in your formula) and divide it by 1, since it's the amount you move in

**one** simulation-tick.

So your x-velocity becomes:

xvelocity = (pos.x - getBounds().x) * 0.05f; |

If you want the overall velocity, you need to apply the rule of pythagoras:

xvelocity = (pos.x - getBounds().x) * 0.05f; yvelocity = (pos.y - getBounds().y) * 0.05f; velocity = Math.sqrt(xvelocity * xvelocity + yvelocity * yvelocity); |

If you want to convert that velocity into

*real-world-centimeters per real-world-seconds* you need to first find out other things like pixel density and game loop speed.

Does this help? Again, for what do you want to use this velocity?