Book Image

JMonkeyEngine 3.0 Cookbook

By : Rickard Eden
Book Image

JMonkeyEngine 3.0 Cookbook

By: Rickard Eden

Overview of this book

Table of Contents (17 chapters)
jMonkeyEngine 3.0 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Handling a game message queue


It is possible to relay most game-related information to the player using a console. However, it's a very basic form of communication. Modern players often expect more graphical ways of receiving information. In this recipe, we'll explore one way of doing this using Nifty. We'll create a dynamic message queue with messages moving in from the right of the screen and fading out once clicked.

It actually doesn't require that many lines of code.

How to do it...

The XML for this recipe can be completed by performing the following five steps:

  1. We start by defining a new <controlDefinition name="gameMessage">.

  2. Inside this, we should add a panel element, and inside this panel element, add two <control name="label"> elements with the ID #title and other contents.

  3. The panel should also have two effects, one onShow trigger and one onHide trigger with move and fade effects respectively, as shown in the following code:

    <onShow name="move" mode="fromOffset" offsetX...