Created
September 24, 2012 10:01
-
-
Save BobTheBuilderBot/3775243 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void update(float tpf) { | |
| camDirection = camera.getDirection().clone().multLocal((playerCharacter.getVelocity())); | |
| camLeft = camera.getLeft().clone().multLocal((playerCharacter.getVelocity())); | |
| camDirection.setY(0); camLeft.setY(0); | |
| walkDirection.set(0, 0, 0); | |
| for(Direction direction : inputDirection) { | |
| switch(direction) { | |
| case Left: | |
| walkDirection.addLocal(camLeft); | |
| break; | |
| case Right: | |
| walkDirection.addLocal(camLeft.negate()); | |
| break; | |
| case Forward: | |
| walkDirection.addLocal(camDirection); | |
| break; | |
| case Backward: | |
| walkDirection.addLocal(camDirection.negate()); | |
| break; | |
| } | |
| playerCharacter.action(new MoveAction(characterControl.getPhysicsLocation())); | |
| } | |
| inputDirection.clear(); | |
| characterControl.setWalkDirection(walkDirection); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment