Book Image

LibGDX Game Development By Example

By : James Cook
Book Image

LibGDX Game Development By Example

By: James Cook

Overview of this book

Table of Contents (18 chapters)
LibGDX Game Development By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The project setup


Ok, new game, new project. We will start with a blank canvas; so go through and create a project like we did in the previous example.

Using the LibGDX Project Generator, call the game FlappeeBee and give it a game class name of FlappeeBeeGame.

The package can be anything you like, and then set the destination to wherever you wish to keep your code. Finally, uncheck every checkbox except Desktop.

Once this is done, click on Generate and then import the project into your choice of IDE.

Setting up the GameScreen class

With this being a fresh project, hot off the generator. It will have the default Hello World! game inside. Just bear this in mind for the moment.

Next, we create our own GameScreen class. Remember, when you create this, we just need it to extend ScreenAdaptor:

public class GameScreen extends ScreenAdapter {
}

The preceding code is what you should have in your GameScreen class for now. So, next we need to populate it with a few things that you might recognize from the...