Guest User

Untitled

a guest
Sep 5th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public class walkTo {
  2.  
  3. private int playerY = player.getY();
  4. private int playerX = player.getX();
  5. private int xSpeed = 1;
  6. private int ySpeed = 1;
  7.  
  8. public static void walkTo(int xMouse, int yMouse) {
  9.  
  10. // Handle our y.
  11. if (playerY < yMouse && playerY + yVelocity <= yMouse) {
  12. playerY += yVelocity;
  13. } else if (playerY < yMouse) {
  14. playerY += 1;
  15. }
  16.  
  17. // Handle our x
  18. if (playerX < xMouse && playerX + xVelocity <= xMouse) {
  19. playerX += xVelocity;
  20. } else if (playerX < xMouse) {
  21. playerX += 1;
  22. }
  23.  
  24. }
  25.  
  26. public void set_xSpeed(int xValue) {
  27. this.xSpeed = xValue;
  28. }
  29.  
  30. public void set_ySpeed(int yValue) {
  31. this.ySpeed = yValue;
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment