Problem with Collisions and movement

I am using my own implementation of collisions for player movement, it is working quite well but there is a small detail that I would like some input on.

My system works by checking if the position where the player wants to move to is open, if there is a collision it does not allow movement, if there is then movement isnt allowed. Now the problem is that the movement speed of my player builds up over time and so if i run into a wall at max speed it will stop me at a greater distance than at a lower speed, and I would like to move the player to the maximum closeness with the wall whatever his current speed. How is this usually solved?

Here is an image to illustrate the problem

Usually you compute the amount of penetration and offset the colliding body by that amount.

You can also use the dimensions of the objects to explicitly set the position. For example, you can set the player’s position to rectangle.x - rectangle.width / 2 - player.width / 2 to place them flush against one another.

We’d need more information on how you’re calculating the collisions to help further, I imagine.

Thanks, that makes sense.

I’m calculating it by creating bounds on the position the player wants to move to and using bounds.instersects with the wall to see if it would generate a collision, if it does I deny the movement.

Well Bounds are axis-aligned bounding boxes (AABBs), so it should be straight forward to implement the second solution I posted originally. Update us if you have any issues.