I'm writing a custom platform engine for my game, and I had a question about 'pushing out' an object from another object. In simple terms, say Mario is falling and he overlaps a platform. We now need to perform a 'push out' loop where we slowly move Mario up until he no longer overlaps and is 'flush' with the platform.
C2 uses sub-pixel precision, so pushing out an object pixel by pixel will yield inconsistent results visually i.e sometimes Mario will be a pixel too high. I've found that pushing out an object at less than a pixel per iteration is more stable, but no matter how small I go (even at 0.01 px/iteration), Mario is still vibrating ever so slightly, giving a blurred look.
Something seems fundamentally wrong with my approach. What's the best way to implement a 'push-out' so that by the end of it 'Mario' is no longer overlapping the obstacle and he is flush with it?