Back to project page Station42.
The source code is released under:
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUC...
If you think the Android project Station42 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.station42.player.move; //from w ww . j a v a 2 s .c o m import com.badlogic.gdx.math.Rectangle; public class EntityMoveState { private enum Directions { UP, LEFT, DOWN, RIGHT }; private float[] moveStates = new float[4]; public float getHorizontal() { return -moveStates[Directions.LEFT.ordinal()] + moveStates[Directions.RIGHT.ordinal()]; } public float getVertical() { return moveStates[Directions.UP.ordinal()] - moveStates[Directions.DOWN.ordinal()]; } public void setUp(float value) { moveStates[Directions.UP.ordinal()] = value; } public void setDown(float value) { moveStates[Directions.DOWN.ordinal()] = value; } public void setLeft(float value) { moveStates[Directions.LEFT.ordinal()] = value; } public void setRight(float value) { moveStates[Directions.RIGHT.ordinal()] = value; } public String toString() { return "" + getHorizontal() + ", " + getVertical(); } public boolean isAnalog() { return true; } }