Listen for attack events. TODO: finish anim. handling
This commit is contained in:
@ -34,6 +34,8 @@ export function useGameControlsComposable(scene: Phaser.Scene, layer: Phaser.Til
|
||||
function handleKeyDown(event: KeyboardEvent) {
|
||||
if (!gameStore.character) return
|
||||
|
||||
// console.log(event.key)
|
||||
|
||||
if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) {
|
||||
pressedKeys.add(event.key)
|
||||
|
||||
@ -43,6 +45,11 @@ export function useGameControlsComposable(scene: Phaser.Scene, layer: Phaser.Til
|
||||
moveCharacter() // Move immediately on first press
|
||||
}
|
||||
}
|
||||
|
||||
// Attack on CTRL
|
||||
if (event.key === 'Control') {
|
||||
gameStore.connection?.emit('map:character:attack')
|
||||
}
|
||||
}
|
||||
|
||||
function handleKeyUp(event: KeyboardEvent) {
|
||||
|
Reference in New Issue
Block a user