moving stuff yes
This commit is contained in:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user