Skip to content

Commit

Permalink
lets hope its not broken this time
Browse files Browse the repository at this point in the history
  • Loading branch information
juxd committed Jan 8, 2021
1 parent 3b48f4e commit f90a25f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 27 deletions.
20 changes: 16 additions & 4 deletions client/clientMain.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import GameClient from './GameClient';
import instantiateClient from './instantiateClient';
import main from './runClient';

const SECRET_KEY_FORM_ID = 'secret-key-form';

Expand Down Expand Up @@ -29,11 +28,24 @@ function handleSecretKeyFormSubmit(e) {
const secretKey = document.getElementById('secret-key').value;

instantiateClient(secretKey)
.then((client) => {
.then(client => {
const canvas = `<canvas id='main-canvas' style="height: 100%; width: 100%"></canvas>`;
container.innerText = "";
container.innerText = '';
container.insertAdjacentHTML('beforeend', canvas);
gameClient = new GameClient(client);
let tick = 0
let previous = performance.now()
const loop = function () {
window.requestAnimationFrame(loop)
const now = performance.now()
const delta = (now - previous) / 1000
previous = now
tick++

gameClient.update(delta, tick, now)
}

loop()
})
.catch((res) => {
alert("shit secret key");
Expand All @@ -51,4 +63,4 @@ if (formId === SECRET_KEY_FORM_ID) {
return;
}

}, false);
}, false);
22 changes: 0 additions & 22 deletions client/runClient.js

This file was deleted.

4 changes: 3 additions & 1 deletion server/GameInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class GameInstance {
if (msg.content.startsWith(prefix)) {
const cmd = msg.content.slice(prefix.length)
if (cmd === 'joinspace') {
msg.author.send(`Your entrance code is: ${this.authDatabase.addUser(msg.member)}`)
const code = this.authDatabase.addUser(msg.member)
console.log(`code assigned: ${code}`)
msg.author.send(`Your entrance code is: ${code}`)
}
return
}
Expand Down

0 comments on commit f90a25f

Please sign in to comment.