mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
Refactor player movement logic to prioritize keyboard input and add idle animation state
This commit is contained in:
@@ -416,11 +416,17 @@ export function updatePlayerMovement() {
|
||||
// Handle keyboard movement (takes priority over mouse movement)
|
||||
if (isKeyboardMoving) {
|
||||
updatePlayerKeyboardMovement();
|
||||
return;
|
||||
} else {
|
||||
// Handle mouse-based movement (original behavior)
|
||||
updatePlayerMouseMovement();
|
||||
}
|
||||
|
||||
// Handle mouse-based movement (original behavior)
|
||||
updatePlayerMouseMovement();
|
||||
// Final check: if velocity is 0 and player is marked as moving, switch to idle
|
||||
if (player.body.velocity.x === 0 && player.body.velocity.y === 0 && player.isMoving) {
|
||||
player.isMoving = false;
|
||||
const animDir = getAnimationKey(player.direction);
|
||||
player.anims.play(`idle-${animDir}`, true);
|
||||
}
|
||||
}
|
||||
|
||||
function updatePlayerKeyboardMovement() {
|
||||
|
||||
@@ -114,6 +114,14 @@
|
||||
"name": "Security Keycard",
|
||||
"takeable": true,
|
||||
"observations": "Electronic access keycard"
|
||||
},
|
||||
{
|
||||
"type": "notes",
|
||||
"name": "Security Log",
|
||||
"takeable": true,
|
||||
"readable": true,
|
||||
"text": "Unusual after-hours access detected:\n- CEO office: 11:30 PM\n- Server room: 2:15 AM\n- CEO office again: 3:45 AM",
|
||||
"observations": "A concerning security log from last night"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user