1
0
forked from noxious/client

tried to un-spaghetti my code

This commit is contained in:
2024-05-07 01:49:39 +02:00
parent 1ab9ae32df
commit 7798426e1b
5 changed files with 89 additions and 96 deletions

View File

@ -1,5 +1,5 @@
<template>
<Sprite ref="sprite" texture="IMap" :x="position.x" :y="position.y" />
<Sprite ref="sprite" texture="player" :x="position.x" :y="position.y" />
</template>
<script lang="ts" setup>
@ -27,10 +27,13 @@ const scene = useScene()
const position = reactive({ x: 0, y: 0 });
if (props.player !== undefined) {
console.log('player', props.player);
position.x = props.player?.coords.x;
position.y = props.player?.coords.y;
}
const pointer_tile = ref(undefined);
function onPointerClick(pointer: Phaser.Input.Pointer) {
const px = scene.cameras.main.worldView.x + pointer.x;
const py = scene.cameras.main.worldView.y + pointer.y;