Perita’s Blog

← Return to blog index

Flick Karts: A New Beginning

We started writting a new game this week: Flick Karts, a digital implementation of the board game PitchCar, a racing simulation where players flick small pucks around a track constructed with puzzle-like pieces, but extended with features hard to do in a physical game, such as different weather conditions and power-up items. In this version the pucks represent karts and players set the angle and force of the flicking by pulling back from the puck’s center, similar to a slingshot.

After our foray into C# and MonoGame, we decided that it was not our cup of tea and went back to Java and libGDX. The first order of business was to set Box2D’s World up so that it has no gravity (i.e., it is a top-down view) and can flick the puck around a test track with the mouse.

Flicking the puck around with the mouse.

It seems, however, that we are easily confused with what units to use in Box2D and how they map to screen coordinates. Our first attempt was to use centimeters to define the puck’s size and having a view of the world of 3 × 1,5 meters.


…
CircleShape shape = new CircleShape();
shape.setRadius(3f);
…
viewport = new ExtendViewport(300f, 150f);
…

The problem is that Box2D then assumes that the puck is a six-meter circle and it was very hard to flick it with the necessary impulse to make it go fast. Therefore, we ended up using meters for everything.


…
CircleShape shape = new CircleShape();
shape.setRadius(0.3f);
…
viewport = new ExtendViewport(3f, 1.5f);
…