1
0
forked from noxious/client

Better anim. timing

This commit is contained in:
Dennis Postma 2024-12-21 02:09:18 +01:00
parent 1a3a53a229
commit 97080d7380

View File

@ -28,14 +28,12 @@ const texture = computed(() => {
const isFlippedX = computed(() => [6, 4].includes(props.zoneCharacter.character.rotation ?? 0)) const isFlippedX = computed(() => [6, 4].includes(props.zoneCharacter.character.rotation ?? 0))
const ANIMATION_MS = 250 // Animation duration in milliseconds
const imageProps = computed(() => ({ const imageProps = computed(() => ({
depth: 1, depth: 1,
originY: [0, 6].includes(props.zoneCharacter.character.rotation ?? 0) ? 4.33 : 5.33, originY: [0, 6].includes(props.zoneCharacter.character.rotation ?? 0) ? 4.33 : 5.33,
flipX: isFlippedX.value, flipX: isFlippedX.value,
texture: texture.value, texture: texture.value,
y: props.zoneCharacter.isMoving ? (Math.floor((scene.time.now / ANIMATION_MS) % 2) === 0 ? -0.5 : 0) : 0, y: props.zoneCharacter.isMoving ? Math.floor(Date.now() / 250) % 2 : 0
// x: props.zoneCharacter.isMoving ? (Math.floor((scene.time.now / ANIMATION_MS) % 2) === 0 ? -1 : 0) : 0,
})) }))
loadSpriteTextures(scene, props.zoneCharacter.character.characterHair?.sprite as SpriteT) loadSpriteTextures(scene, props.zoneCharacter.character.characterHair?.sprite as SpriteT)