forked from noxious/client
Mini cleanup
This commit is contained in:
parent
0e3a0e3dba
commit
2281c2c5e0
@ -28,11 +28,7 @@ const gameStore = useGameStore()
|
|||||||
const mapStore = useMapStore()
|
const mapStore = useMapStore()
|
||||||
const scene = useScene()
|
const scene = useScene()
|
||||||
|
|
||||||
const { characterContainer, characterSprite, getSpriteHeightByAction, currentPositionX, currentPositionY, isometricDepth, isFlippedX, updatePosition, playAnimation, updateSprite, initializeSprite, cleanup } = useCharacterSpriteComposable(
|
const { characterContainer, characterSprite, getSpriteHeightByAction, currentPositionX, currentPositionY, isometricDepth, isFlippedX, updatePosition, playAnimation, updateSprite, initializeSprite, cleanup } = useCharacterSpriteComposable(scene, props.tileMap, props.mapCharacter)
|
||||||
scene,
|
|
||||||
props.tileMap,
|
|
||||||
props.mapCharacter
|
|
||||||
)
|
|
||||||
const { playSound, stopSound } = useSoundComposable()
|
const { playSound, stopSound } = useSoundComposable()
|
||||||
|
|
||||||
const handlePositionUpdate = (newValues: any, oldValues: any) => {
|
const handlePositionUpdate = (newValues: any, oldValues: any) => {
|
||||||
|
@ -11,7 +11,7 @@ import { Image, useScene } from 'phavuer'
|
|||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
mapCharacter: MapCharacter,
|
mapCharacter: MapCharacter
|
||||||
spriteHeight: number
|
spriteHeight: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
@ -103,14 +103,10 @@ export function useCharacterSpriteComposable(scene: Phaser.Scene, tilemap: Phase
|
|||||||
let actionWithDirection = `${currentAction.value}_${currentDirection.value}`
|
let actionWithDirection = `${currentAction.value}_${currentDirection.value}`
|
||||||
if (action) actionWithDirection = action
|
if (action) actionWithDirection = action
|
||||||
|
|
||||||
return sprite?.spriteActions?.find(
|
return sprite?.spriteActions?.find((spriteAction: SpriteAction) => spriteAction.action === actionWithDirection)?.frameHeight ?? 0
|
||||||
(spriteAction: SpriteAction) => spriteAction.action === actionWithDirection
|
|
||||||
)?.frameHeight ?? 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const spriteHeight = computed(() =>
|
const spriteHeight = computed(() => getSpriteHeightByAction(currentAction.value))
|
||||||
getSpriteHeightByAction(currentAction.value)
|
|
||||||
)
|
|
||||||
|
|
||||||
const currentAction = computed(() => {
|
const currentAction = computed(() => {
|
||||||
return mapCharacter.isMoving ? 'walk' : 'idle'
|
return mapCharacter.isMoving ? 'walk' : 'idle'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user