Pathfinding manager will now return path steps in pixel units by default

This commit is contained in:
Hanusiak Piotr 2022-01-19 12:30:08 +01:00
parent f96eac4737
commit f78392ceab
7 changed files with 50 additions and 45 deletions

View file

@ -5,31 +5,20 @@
<script>
window.addEventListener('load', () => {
//@ts-ignore
WA.camera.onCameraUpdate((worldView) => console.log(worldView));
WA.onInit().then(() => {
console.log('After WA init');
const setCameraButton = document.getElementById('setCameraButton');
const followPlayerButton = document.getElementById('followPlayerButton');
const movePlayerButton = document.getElementById('movePlayerButton');
const xField = document.getElementById('x');
const yField = document.getElementById('y');
const widthField = document.getElementById('width');
const heightField = document.getElementById('height');
const smoothField = document.getElementById('smooth');
const lockField = document.getElementById('lock');
const speedField = document.getElementById('speed');
setCameraButton.addEventListener('click', () => {
WA.camera.set(
movePlayerButton.addEventListener('click', async () => {
const position = await WA.player.moveTo(
parseInt(xField.value),
parseInt(yField.value),
widthField.value ? parseInt(widthField.value) : undefined,
heightField.value ? parseInt(heightField.value) : undefined,
lockField.checked,
smoothField.checked,
parseInt(speedField.value),
);
});
followPlayerButton.addEventListener('click', () => {
WA.camera.followPlayer(smoothField.checked);
console.log(position);
});
});
})
@ -38,13 +27,9 @@
<body>
X: <input type="text" id="x" value="496" /><br/>
Y: <input type="text" id="y" value="655" /><br/>
width: <input type="text" id="width" value="480" /><br/>
height: <input type="text" id="height" value="286" /><br/>
Smooth: <input type="checkbox" id="smooth" value=1 /><br/>
Lock: <input type="checkbox" id="lock" value=1 /><br/>
Speed: <input type="text" id="speed" value="20" /><br/>
<button id="setCameraButton">Set Camera</button>
<button id="followPlayerButton">Follow Player</button>
<button id="movePlayerButton">Move Player</button>
</body>
</html>