diff --git a/src/components/game/character/Character.vue b/src/components/game/character/Character.vue index 4c72785..c8b6cd5 100644 --- a/src/components/game/character/Character.vue +++ b/src/components/game/character/Character.vue @@ -2,7 +2,7 @@ - + @@ -28,11 +28,7 @@ const gameStore = useGameStore() const mapStore = useMapStore() const scene = useScene() -const { characterContainer, characterSprite, getSpriteHeightByAction, currentPositionX, currentPositionY, isometricDepth, isFlippedX, updatePosition, playAnimation, updateSprite, initializeSprite, cleanup } = useCharacterSpriteComposable( - scene, - props.tileMap, - props.mapCharacter -) +const { characterContainer, characterSprite, getSpriteHeightByAction, currentPositionX, currentPositionY, isometricDepth, isFlippedX, updatePosition, playAnimation, updateSprite, initializeSprite, cleanup } = useCharacterSpriteComposable(scene, props.tileMap, props.mapCharacter) const { playSound, stopSound } = useSoundComposable() const handlePositionUpdate = (newValues: any, oldValues: any) => { diff --git a/src/components/game/character/partials/CharacterHair.vue b/src/components/game/character/partials/CharacterHair.vue index 87cd718..ad758d0 100644 --- a/src/components/game/character/partials/CharacterHair.vue +++ b/src/components/game/character/partials/CharacterHair.vue @@ -11,7 +11,7 @@ import { Image, useScene } from 'phavuer' import { computed, onMounted, ref } from 'vue' const props = defineProps<{ - mapCharacter: MapCharacter, + mapCharacter: MapCharacter spriteHeight: number }>() diff --git a/src/composables/useCharacterSpriteComposable.ts b/src/composables/useCharacterSpriteComposable.ts index 3e49074..1d59fdb 100644 --- a/src/composables/useCharacterSpriteComposable.ts +++ b/src/composables/useCharacterSpriteComposable.ts @@ -103,14 +103,10 @@ export function useCharacterSpriteComposable(scene: Phaser.Scene, tilemap: Phase let actionWithDirection = `${currentAction.value}_${currentDirection.value}` if (action) actionWithDirection = action - return sprite?.spriteActions?.find( - (spriteAction: SpriteAction) => spriteAction.action === actionWithDirection - )?.frameHeight ?? 0 + return sprite?.spriteActions?.find((spriteAction: SpriteAction) => spriteAction.action === actionWithDirection)?.frameHeight ?? 0 } - const spriteHeight = computed(() => - getSpriteHeightByAction(currentAction.value) - ) + const spriteHeight = computed(() => getSpriteHeightByAction(currentAction.value)) const currentAction = computed(() => { return mapCharacter.isMoving ? 'walk' : 'idle'