Skip to content

Rotating Canvas Games

Menu
  • Games
    • Balloon Shooter
    • Choozak
    • Polar
    • Tap Shoot Zombie!
    • Speedboat Santa
    • Rapid Car Rush
    • Turtle Leap
    • Crossword
  • HTML5 Games
    • Speedboat Santa HTML5
    • Choozak HTML5
  • Blog
  • Tutorials Index
  • About Us
  • Contact Us
  • Privacy Policy & Terms and Conditions
    • Privacy Policy
    • Terms and Conditions
    • Copyright Notice
    • Disclaimer
Menu

Box2d/Libgdx Example Code

Posted on May 8, 2012December 4, 2023 by Rahul Srivastava

Hi, We are uploading source code of a simple box2d-libgdx example. Here is the File In the attachment you would find three projects :-

  • BoxLibgdxExample
  • BoxLibgdxExample-desktop
  • BoxLibgdxExample-android

UPDATE :- The example now contains box2d debug renderer also which can be used to render box2d objects.

Copy them in your eclipse workspace and import the projects in the following way:

  • File->Import->General->Existing Projects into Workspace
  • Then set root directory by browsing to the directory where the above three folders were copied. Then the above three projects would be seen listed.
  • Then click Finish.
Example1
Example2

Finally you would have to a link source of android project to desktop project so that both projects use same source of assets. Right click on  BoxLibgdxExample-desktop in Package Explorer in Eclipse and in Build Path go to Link Source. Browse to the assets folder of BoxLibgdxExample-android and then build all the projects. Example3 Run the desktop project as Java Application and select DesktopGame.java. That should run the example.

For Android Code just check if the build path matches the below screenshot.

Build Path

If you have any issues please post the problem in comments and we would try to solve it. Thank you for the patience

  • Tweet
©2025 Rotating Canvas Games | Built using WordPress and Responsive Blogily theme by Superb