I am making a Java platform game (I have created many top-down games, but nothing with gravity like a platformer) and I have implemented terminalVelocity, etc.
My problem is that, say when the player is falling at a rate of 8 pixels, I check collision for the player 8 pixels ahead before it moves, and if there is a collision the player does not move. But, say that there are 4 pixels until a block but the player is moving at 8 pixels, the collision detection stops the player because 8 pixels ahead there is a block, but the player hovers because there is a 4 pixel gap.
How would I make the player fall those extra 4 pixels?