Game Development Reference
In-Depth Information
Let's see how we can add the functionality to pick up and place blocks. The following fig-
ure is of a resulting terrain block:
1. Begin in CubeWorldAppState by implementing ActionListener to
handle user input. Add a CubeCell field called takenCube to store a
CubeCell field that has been picked up.
2. Add mappings to inputManager to pick up and place a CubeCell field. Use
the left and right mouse button as shown in the following lines of code:
inputManager.addMapping("take", new
MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addMapping("put", new
MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
Search WWH ::




Custom Search