Tuesday, June 14, 2016

Nibbler game tutorial - Java, libgdx, Universal Tween Engine Part 1

Welcome to part one of the Nibbler game tutorial. Nibbler is a game that is a cross between snake and pacman. The point is to traverse a maze and collect "dots" without eating your own tail. It is based off of an older game which I believe was called Nibblet.

The first part of the tutorial will end with you having a game loop in java using libgdx set up. Using libgdx allows us to run the game on many platforms, including Windows, iOS, android and html.

The first thing you want to do is install Eclipse. There are several ways to do this. You will need certain other things installed along with Eclipse. The easiest way I have found is to download in order the applications listed under "Setting up Eclipse" right here

For more help on setting up the environment, check out kilobolt.com's tutorial on how to do this. Pay attention to where the android sdk is downloaded to, you will need to know the directory later.

Next you will want to set up libgdx. Head over to https://libgdx.badlogicgames.com/download.html and download (Download Setup App). Run gdx-setup.jar. This will give you a wizard that will generate the template we will be using. Fill in the values as such:




Click advanced and select Eclipse. Note that you will need to set the directory where the Android sdk is at. Select a new folder on the desktop named "Nibbler" and click generate.

Now open Eclipse and right click in the package explorer and choose Import. Select gradle - gradle project and click next. It will import and that's it.

You will notice that there are folders for all the platforms listed above. The code will be edited in "core." To run the sample program, expand Desktop, and go to src and right click DesktopLauncher.java and run as a java applet. You should get a red screen with a smiley face on it.
If you have gotten to this point, you are ready to go on to part 2.

No comments:

Post a Comment