2022-01-19 09:34:06 +01:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
|
|
|
<script>
|
|
|
|
window.addEventListener('load', () => {
|
|
|
|
//@ts-ignore
|
|
|
|
WA.onInit().then(() => {
|
|
|
|
console.log('After WA init');
|
2022-01-19 12:30:08 +01:00
|
|
|
const movePlayerButton = document.getElementById('movePlayerButton');
|
2022-01-19 09:34:06 +01:00
|
|
|
const xField = document.getElementById('x');
|
|
|
|
const yField = document.getElementById('y');
|
2022-01-19 12:30:08 +01:00
|
|
|
const speedField = document.getElementById('speed');
|
2022-01-19 09:34:06 +01:00
|
|
|
|
2022-01-19 12:30:08 +01:00
|
|
|
movePlayerButton.addEventListener('click', async () => {
|
|
|
|
const position = await WA.player.moveTo(
|
2022-01-19 09:34:06 +01:00
|
|
|
parseInt(xField.value),
|
|
|
|
parseInt(yField.value),
|
2022-01-19 12:30:08 +01:00
|
|
|
parseInt(speedField.value),
|
2022-01-19 09:34:06 +01:00
|
|
|
);
|
2022-01-19 12:30:08 +01:00
|
|
|
console.log(position);
|
2022-01-19 09:34:06 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
X: <input type="text" id="x" value="496" /><br/>
|
|
|
|
Y: <input type="text" id="y" value="655" /><br/>
|
2022-01-19 12:30:08 +01:00
|
|
|
Speed: <input type="text" id="speed" value="20" /><br/>
|
2022-01-19 09:34:06 +01:00
|
|
|
|
2022-01-19 12:30:08 +01:00
|
|
|
<button id="movePlayerButton">Move Player</button>
|
2022-01-19 09:34:06 +01:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|