1
0
forked from noxious/client

Worked on pathfinding, character animation & rotation, few enhancements

This commit is contained in:
2024-07-29 09:01:35 +02:00
parent 56d513021f
commit ea29b6f3a2
9 changed files with 49 additions and 48 deletions

View File

@ -43,4 +43,4 @@ export function useCameraControls(scene: Phaser.Scene): any {
camera,
isDragging
}
}
}

View File

@ -4,13 +4,7 @@ import { getTile, tileToWorldXY } from '@/services/zone'
import { useGameStore } from '@/stores/game'
import { useZoneEditorStore } from '@/stores/zoneEditor'
export function usePointerHandlers(
scene: Phaser.Scene,
layer: Phaser.Tilemaps.TilemapLayer,
waypoint: Ref<{ visible: boolean; x: number; y: number }>,
camera: Ref<Phaser.Cameras.Scene2D.Camera>,
isDragging: Ref<boolean>
) {
export function usePointerHandlers(scene: Phaser.Scene, layer: Phaser.Tilemaps.TilemapLayer, waypoint: Ref<{ visible: boolean; x: number; y: number }>, camera: Ref<Phaser.Cameras.Scene2D.Camera>, isDragging: Ref<boolean>) {
const gameStore = useGameStore()
const zoneEditorStore = useZoneEditorStore()
@ -68,6 +62,7 @@ export function usePointerHandlers(
function setupPointerHandlers() {
scene.input.on(Phaser.Input.Events.POINTER_MOVE, updateWaypoint)
scene.input.on(Phaser.Input.Events.POINTER_WHEEL, handleZoom)
scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone)
// These are for in-game only, not for in the zone editor
if (!zoneEditorStore.active) {
@ -78,6 +73,7 @@ export function usePointerHandlers(
function cleanupPointerHandlers() {
scene.input.off(Phaser.Input.Events.POINTER_MOVE, updateWaypoint)
scene.input.off(Phaser.Input.Events.POINTER_WHEEL, handleZoom)
scene.input.off(Phaser.Input.Events.POINTER_MOVE, dragZone)
// These are for in-game only, not for in the zone editor
if (!zoneEditorStore.active) {
@ -89,4 +85,4 @@ export function usePointerHandlers(
setupPointerHandlers,
cleanupPointerHandlers
}
}
}