Tag Info

Hot answers tagged

1

The conversion from a unit to another is a matter of a simple multiplication. You can implement a ConvertUnits static class with functions like ConvertToGameUnits(), and ConvertToBox2DUnits() to make it easier. I haven't used libgdx or Box2D, but i have used Farseer Physics engine which is basically identical with box2D but made for C#. With that being ...


1

Did some testing and I think your only mistake is in adding the offsets rather than subtracting them. Other than that it's been working for me, although you could simplify those equations quite a bit to get rid of all those divisions. While trying, I've written this example code on JSFiddle. I omitted drawing the grid, but you should see a moving "tile" ...


1

With a camera you separate your game measurements from the screen size and ratio. It is not always better. If you make a board game for example, you can just fit it to the width of the screen, the view will never move anyway. When using pixels to measure, you have no floating point positions. By the way i made a full pong like game without a camera. I ...



Only top voted, non community-wiki answers of a minimum length are eligible