Stop before running into followed Avatar; stop sprite animation
This commit is contained in:
parent
372dda792f
commit
e7f1395809
@ -41,7 +41,7 @@ export class PlayerMovement {
|
|||||||
oldX: this.startPosition.x,
|
oldX: this.startPosition.x,
|
||||||
oldY: this.startPosition.y,
|
oldY: this.startPosition.y,
|
||||||
direction: this.endPosition.direction,
|
direction: this.endPosition.direction,
|
||||||
moving: true,
|
moving: this.endPosition.moving,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ export class Player extends Character {
|
|||||||
|
|
||||||
const distance = Math.pow(xDist, 2) + Math.pow(yDist, 2);
|
const distance = Math.pow(xDist, 2) + Math.pow(yDist, 2);
|
||||||
|
|
||||||
if (distance < 650) {
|
if (distance < 2000) {
|
||||||
this.stop();
|
this.stop();
|
||||||
} else {
|
} else {
|
||||||
const moveAmount = 9 * 20;
|
const moveAmount = 9 * 20;
|
||||||
|
@ -74,7 +74,7 @@ describe("Interpolation / Extrapolation", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should should keep moving until it stops", () => {
|
it("should keep moving until it stops", () => {
|
||||||
const playerMovement = new PlayerMovement({
|
const playerMovement = new PlayerMovement({
|
||||||
x: 100, y: 200
|
x: 100, y: 200
|
||||||
}, 42000,
|
}, 42000,
|
||||||
@ -95,7 +95,7 @@ describe("Interpolation / Extrapolation", () => {
|
|||||||
oldX: 100,
|
oldX: 100,
|
||||||
oldY: 200,
|
oldY: 200,
|
||||||
direction: 'up',
|
direction: 'up',
|
||||||
moving: true
|
moving: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user