Book Image

Learning LibGDX Game Development- Second Edition

Book Image

Learning LibGDX Game Development- Second Edition

Overview of this book

Table of Contents (21 chapters)
Learning LibGDX Game Development Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Manipulating actors through actions


The Actions class offers a large collection of common actions to easily manipulate the Actor objects. Besides action-specific parameters such as the position for a move action, some actions also allow you to specify the duration as well as the interpolation algorithm to be used. An action will always complete in an instant if the duration is either omitted or set to 0. Interpolation algorithms are provided by LibGDX's Interpolation class.

Note

For a quick overview of the available interpolation algorithms in LibGDX, check out Chapter 9, Screen Transitions.

The following example illustrates the typical method signatures of two actions:

moveTo (x, y);
moveTo (x, y, duration);
moveTo (x, y, duration, interpolation);

rotateTo (rotation);
rotateTo (rotation, duration);
rotateTo (rotation, duration, interpolation);

Both the moveTo() and rotateTo() actions have their action-specific parameters x, y, and rotation, respectively, which is the absolute minimum requirement...