Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class walkTo {
- private int playerY = player.getY();
- private int playerX = player.getX();
- private int xSpeed = 1;
- private int ySpeed = 1;
- public static void walkTo(int xMouse, int yMouse) {
- // Handle our y.
- if (playerY < yMouse && playerY + yVelocity <= yMouse) {
- playerY += yVelocity;
- } else if (playerY < yMouse) {
- playerY += 1;
- }
- // Handle our x
- if (playerX < xMouse && playerX + xVelocity <= xMouse) {
- playerX += xVelocity;
- } else if (playerX < xMouse) {
- playerX += 1;
- }
- }
- public void set_xSpeed(int xValue) {
- this.xSpeed = xValue;
- }
- public void set_ySpeed(int yValue) {
- this.ySpeed = yValue;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment