1
0
forked from noxious/client

npm run format, removed container that character was in

This commit is contained in:
2025-01-28 04:57:21 +01:00
parent 027325f2bf
commit abc58bfa38
19 changed files with 123 additions and 69 deletions

View File

@ -1,9 +1,7 @@
<template>
<ChatBubble :mapCharacter="props.mapCharacter" :currentX="currentPositionX" :currentY="currentPositionY" />
<Healthbar :mapCharacter="props.mapCharacter" :currentX="currentPositionX" :currentY="currentPositionY" />
<Container ref="charContainer" :depth="isometricDepth" :x="currentPositionX" :y="currentPositionY">
<Sprite ref="charSprite" :origin-y="1" :flipX="isFlippedX" />
</Container>
<Sprite ref="charSprite" :depth="isometricDepth" :x="currentPositionX" :y="currentPositionY" :origin-y="1" :flipX="isFlippedX" />
</template>
<script lang="ts" setup>
@ -16,7 +14,7 @@ import { calculateIsometricDepth, tileToWorldX, tileToWorldY } from '@/composabl
import { CharacterTypeStorage } from '@/storage/storages'
import { useGameStore } from '@/stores/gameStore'
import { useMapStore } from '@/stores/mapStore'
import { Container, refObj, Sprite, useScene } from 'phavuer'
import { refObj, Sprite, useScene } from 'phavuer'
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
enum Direction {
@ -30,7 +28,6 @@ const props = defineProps<{
mapCharacter: MapCharacter
}>()
const charContainer = refObj<Phaser.GameObjects.Container>()
const charSprite = refObj<Phaser.GameObjects.Sprite>()
const charSpriteId = ref('')
@ -161,13 +158,13 @@ onMounted(async () => {
charSprite.value!.setTexture(charTexture.value)
charSprite.value!.setFlipX(isFlippedX.value)
charContainer.value!.setName(props.mapCharacter.character!.name)
charSprite.value!.setName(props.mapCharacter.character!.name)
if (character.id === gameStore.character!.id) {
mapStore.setCharacterLoaded(true)
// #146 : Set camera position to character, need to be improved still
scene.cameras.main.startFollow(charContainer.value as Phaser.GameObjects.Container)
scene.cameras.main.startFollow(charSprite.value as Phaser.GameObjects.Sprite)
}
updatePosition(character.positionX, character.positionY, character.rotation)