Advertisement
Guest User

Untitled

a guest
May 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. if(entityOnRight){
  2. if(player.getPositionCorner(SquareMapTuples.BOTTOM_RIGHT).x -
  3. ent.getPositionCorner(SquareMapTuples.BOTTOM_LEFT).x > .001f)
  4. player.setMovementBooleans(false, false, false, false);
  5. else
  6. player.setMovementBooleans(true, false, false, false);
  7. }
  8.  
  9. public void setMovementBooleans(boolean canMoveRight, boolean canMoveLeft, boolean canMoveUp, boolean canMoveDown){
  10.  
  11. this.canMoveRight = canMoveRight;
  12. if(canMoveRight == false && moveRight)
  13. vel.x = 0;
  14. }
  15.  
  16. //If you clicked right arrow key and you're not going
  17. //Faster then the max speed
  18.  
  19. if(moveRight && !(vel.x >= 3)){
  20. vel.x += movementSpeed;
  21. }else if(vel.x >= 0 && !moveRight){
  22. vel.x -= movementSpeed * 1.5f;
  23. System.out.println("stopping");
  24. //Make sure it goes to rest
  25. if(vel.x - movementSpeed * 1.5f < 0)
  26. vel.x = 0;
  27. }
  28.  
  29. if(Gdx.input.isKeyPressed(Keys.D) && canMoveRight)
  30. moveRight = true;
  31. else
  32. moveRight = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement