LibGDX Cross-Platform Development Blueprints

Book Description

Develop four exciting, cross-platform games using LibGDX with increasing complexity and understand its key concepts

About This Book

  • Learn how to make a complete game from scratch using the LibGDX framework
  • Discover different aspects of game development, optimize them, and implement them in your games
  • This is a comprehensive guide packed with concepts that are covered in an incremental manner

Who This Book Is For

If you have a good grip of Java and want to explore its capabilities in game development, this book is for you. Basic knowledge of LibGDX is preferred, but is not mandatory.

What You Will Learn

  • Set up the development environment and implement a very simple game type
  • Implement new features such as motion, sounds, and randomness by implementing a new game
  • Add music, physics, and menus to your games
  • Start the creation of a platformer game and apply optimisation techniques
  • Perform collision detection and manage the game assets
  • Render game levels designed in the tool and add enemies
  • Create multiple levels, enemy motion, and level transitions in the game

In Detail

LibGDX is a very popular open source game framework for the Java programming language. It features deployment to multiple platforms with the same code base and it is very fast. Its vast amount of features makes it very easy to learn and master game development without knowing the low-level details.

LibGDX Cross-platform Development Blueprints teaches you the concepts of game development using the LibGDX framework as you make four complete games.

You'll start with setting up the environment, then move on to advanced concepts such as collision detection, memory optimization, and more. The first game is Monty Hall, where you'll learn how to set up LibGDX and use simple graphics. Then, you'll get to know more about concepts such as animation, game sounds, and scoring by developing a Whack a Mole game. This will set up the base for a Bounce the Ball game, where you'll get to grips with advanced concepts such as movements and collisions based on physics. Finally, the Dungeon Bob game will help you understand player motion.

This guide gives you everything you need to master game development with LibGDX.

Style and approach

This is an easy-to-understand guide, packed with examples and illustrations along the way. Complex areas are broken down into bite-size chunks and are explained in detail. The difficulty levels of games are built throughout the chapters.

Table of Contents

  1. LibGDX Cross-Platform Development Blueprints
    1. Table of Contents
    2. LibGDX Cross-Platform Development Blueprints
    3. Credits
    4. About the Author
    5. About the Reviewers
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. 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
    8. 1. Monty Hall Simulation
      1. Setting up
        1. Prerequisites
        2. Installing the Gradle plugin
        3. Using the setup app
        4. Importing projects
      2. Introduction to the game
        1. General flow of the game
        2. Summary of classes
      3. Making the initial screen
        1. Implementing the Door class
        2. Implementing the GameManager class
        3. Implementing the Monty class
      4. Taking input
        1. Updating the GameManager class
        2. Implementing the InputManager class
      5. Adding game logic
        1. Finding doors with goats
        2. Adding game states
      6. Displaying text and implementing restart
        1. Displaying text
        2. Implementing restart
        3. Displaying the background
      7. Summary
    9. 2. Whack-A-Mole
      1. Making the initial screen
        1. Implementing the Mole class
        2. Implementing the GameManager class
        3. Implementing the WhackAMole class
      2. Adding some color
        1. Adding the background
        2. Implementing the holes
        3. Adding moles in holes
      3. Animating the mole
        1. Jumping up and down
        2. Waiting underground
      4. Adding randomness and taking input
        1. Randomizing wait times
        2. Taking input
      5. Adding more effects
        1. Stunning the mole
        2. Adding the stun sign
      6. Keeping scores and adding sounds
        1. Keeping scores
        2. Adding sound effects
      7. Summary
    10. 3. Catch the Ball
      1. Making a moving basket
        1. Implementing the Basket class
        2. Implementing the GameManager class
        3. Implementing the CatchTheBall class
        4. Moving the basket
      2. Throwing the ball
        1. Making the ball
        2. Adding movement
        3. Adding gravity
      3. Detecting collisions
        1. Colliding with the ground
        2. Colliding with the basket
      4. Throwing multiple balls
        1. Throwing the balls after specific intervals
        2. Randomizing and optimizing
      5. Keeping the score and maintaining the high score
        1. Keeping the score
        2. Custom fonts
        3. Saving high scores
      6. Implementing screens
        1. Implementing the menu screen
        2. Implementing screen transitions
        3. Implementing the Back button
        4. Catching the Back button
      7. Adding sound effects and music
        1. Adding sound effects
        2. Adding background music
      8. Summary
    11. 4. Dungeon Bob
      1. Creating the player
        1. Implementing the Bob class
        2. Implementing the GameManager class
        3. Implementing the GameScreen class
      2. Moving the player
        1. Bob's movement on desktop
        2. Continuous movement
        3. Bob's movement on mobile
      3. Character animation
        1. Walking Bob 1
        2. Walking Bob 2
      4. Summary
    12. 5. Using the Tiled Map Editor
      1. Installation and basics
        1. Installing and setting up Tiled
        2. Map layers and drawing
      2. Miscellaneous
        1. Custom properties
        2. Drawing objects
        3. Tile animations and images
      3. Summary
    13. 6. Drawing Tiled Maps
      1. Asset management
        1. Texture packer
        2. The AssetManager class
      2. Rendering maps
        1. Basic map rendering
        2. Reading the map
        3. Map objects
      3. Summary
    14. 7. Collision Detection
      1. Scaling objects and adding a secondary camera
        1. Integrating Bob
        2. Camera control
        3. Integrating game objects
      2. Physics and collision
        1. Adding physics
        2. Collision detection – 1
        3. Collision detection – 2
        4. Jumping
      3. Summary
    15. 8. Collectibles and Enemies
      1. Collecting items and detecting hazards
        1. Collecting objects
        2. Displaying the score and adding hazards
      2. Enemies
        1. Adding enemies
        2. Adding enemies through Tiled
        3. Enemy motion
      3. Summary
    16. 9. More Enemies and Shooting
      1. Skeletons and chasing
        1. Skeletons
        2. Chasing Bob
      2. Shooting and stars
        1. Stars
        2. Shooting
      3. Summary
    17. 10. More Levels and Effects
      1. Multiple levels
        1. Adding the door
        2. Changing levels
        3. Respawning Bob
      2. Particle effects
        1. Editor setup and basics
        2. The Effect Emitters section
        3. The Emitter Properties section
        4. Loading the effect into the game
      3. The loading screen
        1. Game states
        2. Integrating the screen in the game
      4. Summary
    18. Index

Product Information

  • Title: LibGDX Cross-Platform Development Blueprints
  • Author(s): Indraneel Potnis
  • Release date: December 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781783982066