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

Enhancing the game screen's GUI


The last part of this chapter is dedicated to two enhancements of the game screen's GUI. Firstly, we will add a small animation that gives visual feedback to the player when a life is lost. Secondly, a counting-up animation for the player's score will be implemented.

Event – player lost a life

We want to play a small animation in the event when the player has just lost a life. The extra lives are shown as bunny heads in the top-right corner of the game screen. These icons become dark one after another as soon as another life has been lost. The animation we are aiming for is a temporary bunny head icon on top of the just lost extra life. The temporary icon is going to be scaled up, rotated, and will have a slightly red tint.

The following screenshot is an example of the animation:

Add the following line to the WorldController class:

public float livesVisual;

After this, make the following changes to the same class:

private void init () {
Gdx.input.setInputProcessor...