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

Implementing a game console


A console can be a very powerful tool that allows a player to have control over game functions that might either not have a functional UI yet, or where setting up a UI is simply not be feasible due to its complexity.

This recipe will implement a console in the main screen from the first recipe in this chapter and also use the Move effect to slide it in and out of view. Moreover, it will describe how to use console commands to let the player control the game functions.

How to do it...

Just as before, we begin by defining a control that will host the console. It can be done by performing the following four steps:

  1. Inside the <nifty-controls> tags, we add a new <controlDefinition name="consoleControl"> class.

  2. Then, we add a small console, aligning it with the bottom of the screen:

    <control id="console" name="nifty-console" lines="10" width="100%" valign="bottom" backgroundColor="#6874" visible="true">
  3. To spice up the simple console, we give it a Move effect...