Added playSound func, use this on attack
This commit is contained in:
@ -41,7 +41,7 @@ export function useGameControlsComposable(scene: Phaser.Scene, layer: Phaser.Til
|
||||
|
||||
// Start movement loop if not already running
|
||||
if (!moveInterval) {
|
||||
moveInterval = window.setInterval(moveCharacter, 250) // Adjust timing as needed
|
||||
moveInterval = window.setInterval(moveCharacter, 100) // Adjust timing as needed
|
||||
moveCharacter() // Move immediately on first press
|
||||
}
|
||||
}
|
||||
|
10
src/composables/useGameComposable.ts
Normal file
10
src/composables/useGameComposable.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export function useGameComposable() {
|
||||
const playSound = (sound: string) => {
|
||||
const audio = new Audio(sound)
|
||||
audio.play().catch(console.error)
|
||||
}
|
||||
|
||||
return {
|
||||
playSound
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user