Creating our level selection system
Chances are, if you've ever played a mobile game with multiple levels then you already have an idea of what we'll be working with in this chapter. We're going to be creating a class which provides our game with a grid containing level tiles that we can use in order to allow a user to select a level to play. This class can be very easily managed and is highly customizable, from button texture, column count, row count, and more, with ease. The end result will look something like this:
Note
This implementation of the LevelSelector
class extends AndEngine's Entity
object. This makes applying transitional effects with entity modifiers and allowing scrolling based on touch events a rather trivial task.
Getting ready…
The LevelSelector
class is highly based on the use of AndEngine's Entity
, Sprite
, and Text
objects. In order to understand how LevelSelector
works, please take the time to go over the recipes regarding these objects. These recipes include, Understanding...