Click in the box and Control the car using the arrow keys.
(For some reason in Chrome, the down arrow key will scroll the page. So, if you want to play the game in Chrome, go to this link: Game)
I’m working on a top down car game using libGDX, the Desktop/Android/HTML5 Java game development framework. I am new to all this, so the idea of creating a car with the correct physics from scratch seemed daunting. Rather than reinventing the wheel (or car in this case), I set out to to find someone who had done something similar and use that as a foundation.
Domas created a nifty little car that will work perfectly for my game and he has simple, well commented code describing how to do it. I only needed to convert it to libGDX. His example uses Box2D. libGDX has its own implementation of Box2D built in which made the conversion pretty easy. Since Domas and team were so kind to release the code for BanditRacer and this Top-Down Car, I felt I should share the code for this conversion.
I have included a link to a zip file of the code. I’ve kept it pretty simple and have just included the four java files. You can just plop the four java files into a new libGDX project. If anyone is interested, I can put the complete libGDX Eclipse projects online somewhere, so that you can just import them into Eclipse and you’d be up and running. I just haven’t gone to the trouble to do that.
I hope you can make use of this code in your own project. Enjoy!
Here is the code >> TopDownCar-Code