Resolution independent physics

Posted by user46877 on Game Development See other posts from Game Development or by user46877
Published on 2014-06-07T12:21:54Z Indexed on 2014/06/07 15:41 UTC
Read the original article Hit count: 378

Filed under:
|
|
|
|

I'm making a game like Doodlejump but don't know how to make the physics scale on multiple resolutions. I also can't find anything related to this on Google. Right now I'm scaling the game using letterboxing and tested scaling the jump height with this code:

gravity = graphics.getHeight() * 0.001f;
jumpVel = graphics.getHeight() * -0.04f;

...

velY += gravity;
y += velY;

But if I test this on my smartphone or emulator with different resolutions, I always get a slightly different jump height. I know that Farseer is resolution independent. How can I replicate this in my game?

Thanks in advance.

© Game Development or respective owner

Related posts about 2d

Related posts about android