moving stuff yes

This commit is contained in:
Zaxiure
2024-09-25 01:13:04 +02:00
parent 778c10a9ce
commit 910a9fa2cf
4 changed files with 22 additions and 4 deletions

View File

@ -1,7 +1,11 @@
import { useGameStore } from '@/stores/gameStore'
import { useScene } from 'phavuer'
import { watch } from 'vue'
import { useZoneStore } from '@/stores/zoneStore'
export function useCameraControls(scene: Phaser.Scene): any {
const gameStore = useGameStore()
const zoneStore = useZoneStore()
const camera = scene.cameras.main
function onPointerDown(pointer: Phaser.Input.Pointer) {
@ -14,6 +18,15 @@ export function useCameraControls(scene: Phaser.Scene): any {
gameStore.setPlayerDraggingCamera(false)
}
watch(
() => zoneStore.characterLoaded,
(characterLoaded) => {
if(characterLoaded) {
scene.cameras.main.startFollow(scene.children.getByName(gameStore.character.name));
}
}
)
scene.input.on(Phaser.Input.Events.POINTER_DOWN, onPointerDown)
scene.input.on(Phaser.Input.Events.POINTER_UP, onPointerUp)