Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Introducing the Scene2D API


Before getting your hands dirty, it becomes absolutely necessary to clear up some key concepts:

  • Actor: This represents a node within the scene graph and its default properties are position, size, origin, scale, rotation, Z-index, and color. In the context of this chapter, a node can contain a widget or a group of them taking into account that it will work in its local coordinate system, which means that transformations are performed relative to its current coordinate frame's origin and axes. Apart from that, it knows how to draw itself.

    Note

    Z-index refers to the level of depth when rendering. In the next image, you can see that the square with the higher z-index overlaps the other two.

    Scene2D actors can serve as any type of game element. However, they are often used for UI purposes (buttons, labels, checkboxes, and so on).

  • Action: This consists of a progressive or immediate transformation to perform over an actor, for example, rotating a button or coloring an image...