Add an actions package to abstract some simple behaviors
Summary
Add a rage.actions.*
package to have objects that encapsulate behaviors to be executed, such as exiting a game, moving an object, etc.
Example
An Action
would encapsulate a behavior. One behavior could be performing an "exit" action when the ESC key is pressed:
// ...
ExitGameAction exitAction = new ExitGameAction(this);
// ...
float time = getEngine().getElapsedTimeMillis();
exitAction.performAction(time); // --> game.setState(Game.State.STOPPING); internally
or moving a rage.scene.Node
forward when another key is pressed:
MoveForwardAction forwardAction = new MoveForwardAction(gameObjectNode);
// ...
float time = getEngine().getElapsedTimeMillis();
forwardAction.performAction(time); //
Benefits
It would help encapsulate behaviors in a cleaner way, make the code easier to understand, and so on. It could also be easier to integrate with other sub-systems that are willing to accept a rage.actions.Action
type.