Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(entityOnRight){
- if(player.getPositionCorner(SquareMapTuples.BOTTOM_RIGHT).x -
- ent.getPositionCorner(SquareMapTuples.BOTTOM_LEFT).x > .001f)
- player.setMovementBooleans(false, false, false, false);
- else
- player.setMovementBooleans(true, false, false, false);
- }
- public void setMovementBooleans(boolean canMoveRight, boolean canMoveLeft, boolean canMoveUp, boolean canMoveDown){
- this.canMoveRight = canMoveRight;
- if(canMoveRight == false && moveRight)
- vel.x = 0;
- }
- //If you clicked right arrow key and you're not going
- //Faster then the max speed
- if(moveRight && !(vel.x >= 3)){
- vel.x += movementSpeed;
- }else if(vel.x >= 0 && !moveRight){
- vel.x -= movementSpeed * 1.5f;
- System.out.println("stopping");
- //Make sure it goes to rest
- if(vel.x - movementSpeed * 1.5f < 0)
- vel.x = 0;
- }
- if(Gdx.input.isKeyPressed(Keys.D) && canMoveRight)
- moveRight = true;
- else
- moveRight = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement