LibGDX Game Development Essentials

Book Description

Make the most of game development features powered by LibGDX and create a side-scrolling action game, Thrust Copter

In Detail

This book focuses on teaching LibGDX and its incredible features with a balanced mix of theory and practice. As you proceed through the book, you will create a 2D game in parallel and work on active coding as well. The source code of the game and all the experiments that are done in the book are also provided to get you started quickly and easily.

The game you will develop is a simple one, aimed at helping beginners learn the basics from start to finish. You will develop the complete game and as a next step you will integrate the Box2D physics engine by replacing the existing code. The book teaches you how to create GUI elements using Scene2D and helps you with everything that is involved, from the creation to the publishing of a game. In later chapters, you will learn about 3D in LibGDX and 3D physics using Bullet. The final chapter details the process involved in publishing the game to Google Play, Apple App Store, PC, and the Web.The book covers all the relevant topics of LibGDX game development but makes sure that even a beginner can easily follow the development with the help of sample code and illustrations.

What You Will Learn

  • Wire up Eclipse with ADT, Gradle, and other relevant plugins
  • Set up, upgrade, and maintain a Gradle-based LibGDX project
  • Develop a complete Flappy Bird-like game, Thrust Copter, while learning about all of the relevant packages in LibGDX
  • Create the menu and UI of the game using Scene2D
  • Use the Particle Editor and add smoke and explosion effects to the game
  • Convert the game to use Box2D physics in place of custom code
  • Play with simple 3D scene experiments with integrated bullet physics
  • Publish the game to Google Play, the App Store, and the Web

Publisher Resources

Download Example Code

Table of Contents

  1. LibGDX Game Development Essentials
    1. Table of Contents
    2. LibGDX Game Development Essentials
    3. Credits
    4. About the Author
    5. Acknowledgments
    6. About the Reviewers
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    9. 1. Wiring Up
      1. Getting started
        1. Setting up the Java development environment
        2. Installing Eclipse
      2. Setting up the Android development environment
        1. Installing the ADT plugin and linking the Android SDK with Eclipse
        2. Installing the LibGDX support plugins
        3. Setting up GWT
        4. Installing the RoboVM plugin
        5. Installing the Gradle plugin
      3. The LibGDX Gradle combo
        1. Using the Gradle setup application
          1. A Hello World project
          2. Importing Gradle projects to Eclipse
          3. Running the project
      4. Exploring the project
        1. Displaying the Hello World text
        2. Running demos
          1. Running tests
        3. The alternate LibGDX setup
      5. Summary
    10. 2. Let There Be Graphics!
      1. The ThrustCopter game
        1. A LibGDX app's life cycle
          1. Creating the Thrust Copter project
          2. Planning art assets
          3. The game scene
          4. Populating the game scene
      2. Displaying the graphics
        1. The final game scene
          1. Adding the plane animation
          2. Moving the plane
        2. The code so far
        3. Texture packing
          1. The revised code
        4. Handling multiple screen sizes and aspect ratios
      3. Summary
    11. 3. Thou Shall Not Pass!
      1. Piloting our plane
        1. Navigating using touch input
          1. Dealing with other input methods
          2. Polling keyboard keys
          3. Accessing accelerometer data
          4. Event handling for inputs
          5. Using the InputAdapter class
            1. Capturing gestures
            2. Game controllers controller
        2. Adding the different game states
          1. Adding the pillar rocks
            1. Collision with the pillars
          2. Adding meteor rocks
            1. Collision with the meteor rock
        3. Making the game easier
        4. Playing with audio
          1. Adding sound effects
      2. Summary
    12. 4. Bring in the Extras!
      1. Refactoring time
        1. Creating a ThrustCopterScene class
          1. Creating our Game class instance
            1. More refactoring
            2. Using AssetManager
      2. Time for pickups
        1. Using a pickup class
          1. Adding pickup logic
            1. Heads Up Display (HUD) UI
      3. Displaying text
        1. Hiero – the BitmapFont creator tool
      4. Special effects with particles
        1. Pooling particle effects
      5. Summary
    13. 5. Scene 2 – the Menu
      1. Introducing Scene2D
        1. The stage for actors
          1. Actors and their actions
        2. Widgets
        3. Adding a loading scene
          1. Investigating the LoadingScreen class
        4. Adding the menu scene
          1. Creating scalable skins using the 9-patch tool
      2. Handling the Android back button
      3. Summary
    14. 6. Physics with Box2D
      1. The incredible world of Box2D
      2. LibGDX with Box2D
        1. Creating a Box2D world
          1. Drawing the Box2D world
          2. Simulating the Box2D world
      3. Fixing the time step
      4. Box2D rigid bodies
        1. Interactions in the Box2D world
          1. Linking the Box2D and game worlds
          2. Detecting collisions
      5. Box2D version of Thrust Copter
        1. Creating and placing objects
        2. Creating obstacles
        3. Drawing the scene
      6. Handling collisions
        1. Ignoring collisions with shield
        2. Collision for pickups
      7. Summary
    15. 7. The Amazing World of 3D
      1. Introducing the third dimension
        1. Creating 3D content
          1. The PerspectiveCamera class
      2. Converting 3D files to G3DB
      3. Playing with primitives
        1. Rendering the ModelInstance classes
          1. Loading 3D models
            1. Playing animations
      4. Interacting with 3D objects
        1. 3D frustum culling in LibGDX
          1. 3D particles with Flame
      5. Using bullet physics
        1. Creating the bullet world
          1. Adding rigid bodies
          2. Collision detection
          3. Adding shadows
      6. Summary
    16. 8. Saving Our Data
      1. Persisting game preferences
        1. Saving and loading sound preferences
      2. Implementing a local leaderboard
        1. Filesystems and access permissions
          1. Reading and writing files
          2. The leaderboard
          3. Saving and displaying scores
      3. Tile-based level design
        1. Using Tiled
          1. Loading TMX levels
      4. Summary
    17. 9. Finishing Our Android Game
      1. Using Google's offerings
        1. Interfacing platform-specific code
        2. Implementing Google Analytics tracking
        3. Adding tracker configuration files
        4. Adding Google Mobile Ads
      2. Leaderboards and achievements using Google Play services
        1. Linking BaseGameUtils
          1. Wiring with code
      3. Famous third-party alternatives
        1. Flurry for analytics
        2. Ads from InMobi
        3. Swarm – the all-in-one package
      4. Creating icons
      5. Summary
    18. 10. Time to Publish
      1. Publishing the Android version
        1. Preparing the store listing
          1. Preparing to release the APK
      2. Publishing the desktop version
      3. Publishing the Web version
      4. Publishing the iOS version
        1. First steps at the developer portal
        2. Preparing the iOS project
        3. Testing the build on a device
        4. Creating the IPA
      5. Some useful resources and links
        1. Overlap2D
          1. Working with Overlap2D
      6. Summary
    19. Index

Product Information

  • Title: LibGDX Game Development Essentials
  • Author(s):
  • Release date: December 2014
  • Publisher(s): Packt Publishing
  • ISBN: 9781784399290