moving stuff yes
This commit is contained in:
@ -15,12 +15,13 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Container, Image, RoundRectangle, Sprite, Text, useScene } from 'phavuer'
|
||||
import { Container, Image, refObj, refTo, RoundRectangle, Sprite, Text, useScene } from 'phavuer'
|
||||
import { type ExtendedCharacter as CharacterT } from '@/types'
|
||||
import { calculateIsometricDepth, tileToWorldX, tileToWorldY } from '@/composables/zoneComposable'
|
||||
import { watch, computed, ref, onMounted, onUnmounted } from 'vue'
|
||||
import config from '@/config'
|
||||
import { useGameStore } from '@/stores/gameStore'
|
||||
import { useZoneStore } from '@/stores/zoneStore'
|
||||
|
||||
enum Direction {
|
||||
POSITIVE,
|
||||
@ -28,7 +29,7 @@ enum Direction {
|
||||
NOCHANGE
|
||||
}
|
||||
|
||||
const charContainer = ref<Phaser.GameObjects.Container | null>(null)
|
||||
const charContainer = refObj();
|
||||
|
||||
interface Props {
|
||||
layer: Phaser.Tilemaps.TilemapLayer
|
||||
@ -40,6 +41,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
})
|
||||
|
||||
const gameStore = useGameStore()
|
||||
const zoneStore = useZoneStore()
|
||||
const scene = useScene()
|
||||
|
||||
const isometricDepth = ref(calculateIsometricDepth(props.character!.positionX, props.character!.positionY, 28, 94, true))
|
||||
@ -167,7 +169,8 @@ onMounted(() => {
|
||||
*/
|
||||
// Check if player is this character, then lock with camera
|
||||
if (props.character && props.character.id === gameStore.character?.id) {
|
||||
scene.cameras.main.startFollow(charContainer.value as Phaser.GameObjects.Container)
|
||||
charContainer.value?.setName(props.character.name)
|
||||
zoneStore.characterLoaded = true;
|
||||
}
|
||||
if (props.character) {
|
||||
updatePosition(props.character.positionX, props.character.positionY, Direction.POSITIVE)
|
||||
|
Reference in New Issue
Block a user