forked from noxious/client
Centered camera & Modal position changes
- Able to give position to modal other then centered. - Camera now centered on character when - Character joins zone - Character teleports on to zone - Window resize
This commit is contained in:
@ -6,6 +6,15 @@ export function useCameraControls(scene: Phaser.Scene): any {
|
||||
const camera = ref(scene.cameras.main)
|
||||
const isDragging = ref(false)
|
||||
|
||||
// Resize center camera on character.
|
||||
window.addEventListener('resize', () => {
|
||||
console.log('woep')
|
||||
// Need to change camera position next frame
|
||||
setTimeout(() => {
|
||||
scene.cameras.main.setScroll(-(scene.cameras.main.worldView.width/2) + gameStore.character.relativePosition.x, -(scene.cameras.main.worldView.height/2) + gameStore.character.relativePosition.y)
|
||||
}, 0)
|
||||
})
|
||||
|
||||
function onPointerDown(pointer: Phaser.Input.Pointer) {
|
||||
if (pointer.event instanceof MouseEvent || pointer.event.shiftKey) {
|
||||
isDragging.value = true
|
||||
|
Reference in New Issue
Block a user