Chapter 8. Why Are All the Birds Angry?

Another new chapter and another new game! This time around we are going to be looking at making a simplified version of a modern-day mobile classic. That's right; we are going to have a look at Angry Birds.

For those that might be keen to see what this chapter will help you make, you can view a quick video of it at https://www.youtube.com/watch?v=7Xot-5pkjIY.

By choosing this game as a game to remake, we get the chance to look at some more advanced features of LibGDX, in particular the popular Box2D physics engine. Once again, we will be revisiting the great tool, that is, Tiled, for level creation and integration with Box2D, to simplify the design process.

To finish off, we will look at handling different types of input for the mouse (or finger, for mobiles) with actions such as drag. We will cover the following topics:

  • The what, why, and how of Angry Birds
  • Setting up a new project with Box2D
  • Box2D with LibGDX
  • Creating a world
  • Nutty birds

The what, why, and how of Angry Birds

For our final game, we are looking at Angry Birds; for some, this will have been a staple game in your library since its launch in 2009. But just in case you have lived under a rock for the last few years, let's have a quick rundown on the game.

Angry Birds was first released on iPhones back in 2009, created by a company called Rovio. With around 2 billion downloads, it is one of the most popular games ever created.

From a gameplay perspective, the aim of the game is for the player to slingshot a bird, a very angry bird, into the enemy pigs' fortress. The idea is to eliminate all the pigs before the player runs out of birds to fling across the screen. The game mixes this action with a puzzle element as each fortress is differently designed with differing materials that require different attack tactics, and also there are different types of birds with different abilities that can be selected. Let's take a look at the following image:

The what, why, and how of Angry Birds

The preceding is a screenshot of Angry Birds, showing a bird being flung into the enemy fortress.

Why?

The reason I chose Angry Birds as the game is partly due to its popularity but also because of a technical aspect with the introduction of Box2D. In fact, Box2D is the exact same technology Rovio used in Angry Birds, so it made sense. This also introduces the external dependency ability of LibGDX.

How?

LibGDX has this cool extension capability that allows you to add external libraries in a nice slick manner. Since Box2D is in essence a C/C++ library, it needs to be wrapped with some awesome Java Native wrapper code that funnily enough comes with the LibGDX extension. So, all the methods available natively will be available to us!

We will have Box2D for the physics, and then we will use Tiled for our level design. We then just have to glue it all together using LibGDX!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.172.38