Programming Games for Android

Programming Games for Android 13: 2D Scene

42 videos

238 minutes

As you see I deleted all the code that had done before because we have already seen, the basic concepts. Let's start doing our clone of Geometry Dash Scene2D using the library. Scene2D is an interesting library that comes with serving libgdx to build 2D scene graph. You may ask what this is a scene graph and why it is important to consider. The problem games

It is that normally control everything that has a game is a somewhat complicated operation because they are different things, is a framework that we have to control us, and we have a game, moving objects, we must control how things are moving ... then it may be an operation we can get out of hand. To facilitate developing new games libgdx includes a library for graphs scene called Scene2D.

It's comfortable because first comes standard with libgdx, so it ended be looking for alternatives; second because it is simple to use, in no time you can display things on the screen impressively and encourage them and do all sorts of things with it; and finally because it is quite rich, not only lets you add things, lets scale it, rotate it, even supports input management through its input processor system, collisions,

leaving check when an actor has collided system, and lets you do a lot of other things as if it were a scene. In fact you create a scene, as if it were a play, and add actors, who are to be placed one on another screen and moving by doing what you have to do. We can interact with them through the entrance, fire behavior when you press a button or when we play or when we do any

type of interaction with them and add actions to encourage them in an interesting way with only give a line of code, and make them move straight or have a curious trajectory. The scene graph, it is true that this image has many years but remains as valid. The scene graph is that you are seeing: a scenario of different actors ranging hanging. They can hang groups, which are like

actors but contain them. Inside they behave the same. They can check through behaviors everything that has to do with actors, as draw, see if we pressed keys, couple them Listeners to process your input as we do with the InputProcessor. It is very comfortable and convenient for new, as I say. But it also has another advantage Scene2D and supporting a system called Scene2D UI,

what is right when we graphical interfaces such as buttons in the menu screen because it is complex: we have to design our own pictures, we have to put the buttons there ... if we are new we do so or may not know something but in this case comes to learning. If you already have a way to do it very intuitive to use better. In the case of Scene2D have our own package type classes

User interface, making it easy to integrate into our game buttons, text labels ... these buttons can be rotated, and although it is the image can touch, interact with them and encouraged. We all we have to do is provide the paths to the textures we want to use these buttons, or sources that we want to use and it's really very simple, because everything else he does, and are actors

we can add to the scene as anything else. If we look for something more sophisticated, but is beyond the scope of this tutorial, but if you are wanting is recommended, using control systems better facts Scene2D entities, which is fine but better done. In particular I recommend Ashley, which is what is better integrated with libgdx, and in fact can dial extensions on the screen

when you think your project, and is an ECS. The ECS are more advanced systems because they leave organize the elements of the game in the form of components and add special behaviors, and introduce systems, and is very interesting to an ECS by Ashley because it is very simple to use and it integrates great with libgdx. For now let's focus on Scene2D, which will give us all we need all we need

for our game at this time.

To find new courses, subscribe. There will be no spam, promised :)

About the Author

foto de jotajotavm
José Javier Villena

Biography: Analyst-Programmer in different languages. Tutor PREMIUM platforms recognized worldwide as CodigoFacilito. Editor Cristalab articles. My YouTube Channel is sponsored by the ANAYA and LaTostadora publisher. I like to explain in detail and give several examples for the avoidance of doubt.