|
|
@@ -511,11 +511,14 @@ async function move(direction) {
|
|
|
await smoothMoveTo(newX, newY);
|
|
|
output.value += `${moveType}到: (${newX}, ${newY})\n`;
|
|
|
|
|
|
- // 检查是否到达终点
|
|
|
- if (newX === endPoint.value.x && newY === endPoint.value.y) {
|
|
|
- gameState.player.hasReachedEnd = true;
|
|
|
- gameState.player.direction = 1;
|
|
|
- showGameMessage('恭喜你到达终点!', 'success');
|
|
|
+ // 检查是否到达终点 - 确保在动画完全完成后才触发终点效果
|
|
|
+ if (Math.abs(newX - endPoint.value.x) < 0.01 && Math.abs(newY - endPoint.value.y) < 0.01) {
|
|
|
+ // 等待动画完全完成后再标记到达终点
|
|
|
+ setTimeout(() => {
|
|
|
+ gameState.player.hasReachedEnd = true;
|
|
|
+ gameState.player.direction = 1;
|
|
|
+ showGameMessage('恭喜你到达终点!', 'success');
|
|
|
+ }, 500); // 等待动画持续时间
|
|
|
output.value += '恭喜你到达终点!';
|
|
|
}
|
|
|
} else {
|