This commit is contained in:
biglyderv 2024-11-25 14:14:21 -05:00
parent edd005cb4d
commit 5414c719f1
6 changed files with 141 additions and 10 deletions

View file

@ -11,9 +11,10 @@
<h1>UniButton</h1>
<p>The <b>left mouse button</b> is the only input. No keyboard, moving the mouse, or anything else.</p>
<p>Click to launch... figure out the rest of the combos yourself.</p>
<a class='button' href='https://zenoverse.net/'>Created by Onez</a>
<a class='button' href='https://git.xuyezo.net/explore/repos'>Created by Zux</a>
<a class='button' href='https://discord.gg/wZ3mg58JMT'>Join our
Discord</a>
<a class='button' href='https://bg.xuyezo.net/client/login?redirect=https://ub.xuyezo.net/'>Log in</a>
<canvas id='canvas'></canvas>
</div>
</section>

View file

@ -155,7 +155,11 @@ class Game extends GameBasic {
player.ref = false;
}
this.ws.send(JSON.stringify(player.legalProps.map(prop => player[prop])));
let p = player.legalProps.map(prop => player[prop]);
p.splice(0,0,'SYNC');
this.ws.send(JSON.stringify(p));
}
recv({ data }) {
let { player } = this;
@ -225,6 +229,7 @@ class Game extends GameBasic {
if (this.entities.length == 0) this.entities = [this.player];
}
async init() {
let tok = new URL(window.location).searchParams.get('token');
super.init();
let that = this;
@ -235,6 +240,9 @@ class Game extends GameBasic {
this.ws.addEventListener('open', function () {
that.sync(true);
if (tok) {
that.ws.send(JSON.stringify(["AUTH",tok]));
}
setInterval(function () { that.sync() }, 1000 / 5);
})