Package be.demmel.jgws.actions

Examples of be.demmel.jgws.actions.MovePlayerAction


            MovementState movementState = character.getMoveState();

            switch (movementState) {
                case MOVE_CHANGE_DIR:
                    MovePlayerAction movePlayerActionChangeDir = new MovePlayerAction(channel, channels);
                    this.actionQueue.addAction(movePlayerActionChangeDir);

                    character.setMoveState(MovementState.MOVE_KEEP_DIR);
                    break;
                case MOVE_KEEP_DIR:
                    // Only move the player each 250ms (if the direction is kept)
                    if ((new Date().getTime() - character.getLastHeartBeat().getTime()) > 250) {
                        MovePlayerAction movePlayerActionKeepDir = new MovePlayerAction(channel, channels);
                        this.actionQueue.addAction(movePlayerActionKeepDir);
                    }
                    break;
                case NOT_MOVING_UNHANDLED:
                    MovePlayerAction movePlayerActionUnhandled = new MovePlayerAction(channel, channels);
                    this.actionQueue.addAction(movePlayerActionUnhandled);
                   
                    // Calculate the rotation
                    character.setRotation((float)Math.atan2(character.getDirection().getY(), character.getDirection().getX()));
                    RotatePlayerAction rotatePlayerAction = new RotatePlayerAction(channel, channels);
View Full Code Here

TOP

Related Classes of be.demmel.jgws.actions.MovePlayerAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.