1
0
forked from noxious/client

pointer fix

This commit is contained in:
root
2024-05-02 20:17:26 +02:00
parent 69db126754
commit 373987afc2
2 changed files with 12 additions and 9 deletions

View File

@ -34,16 +34,21 @@ const onPointerMove = (e: Phaser.Input.Pointer) => {
const py = scene.cameras.main.worldView.y + e.y;
pointer_tile.value = getTile(px, py, props.layer);
waypoint.value.visible = true;
if (pointer_tile.value) {
waypoint.value.visible = true;
if (pointer_tile.value !== undefined) {
// Convert tile coordinates to world coordinates
const worldPoint = props.layer.tileToWorldXY(pointer_tile.value.x, pointer_tile.value.y);
waypoint.value.x = worldPoint.x;
waypoint.value.y = worldPoint.y;
waypoint.value.x = worldPoint.x + 32;
waypoint.value.y = worldPoint.y + 32;
} else {
waypoint.value.visible = false;
}
};
onPreUpdate(() => {
})