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

Attaching an input AppState object


In this recipe, we will make an AppState object, which will handle the player input for a character. It's a great way to add functionality to the application in a modular way. The AppState object we create here could easily be added during the game and removed or disabled during cut scenes or while in the game menu.

Getting ready

We won't require any special assets for this recipe, but it will be beneficial to have a basic understanding of how AppState works and its purpose in jMonkeyEngine. This particular implementation of the recipe will use the character-control class created in the previous example. It can still be used to manipulate a spatial object directly without the GameCharacterControl class. This recipe will provide pointers on where to do this.

How to do it...

To attach an input AppState object, perform the following steps:

  1. Start off by creating a class called InputAppState, extending AbstractAppState, and implementing ActionListener and AnalogListener...