add simple fuzz test
This commit is contained in:
parent
0a90b6b77a
commit
27520842e3
59 changed files with 191 additions and 34 deletions
47
public/static/js/wingbase/main.js
Normal file
47
public/static/js/wingbase/main.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
'use strict';
|
||||
|
||||
window.addEventListener('load', init);
|
||||
|
||||
var game;
|
||||
|
||||
function init() {
|
||||
game = new Game();
|
||||
|
||||
game.tick();
|
||||
|
||||
//game.net.connect();
|
||||
}
|
||||
|
||||
class Game {
|
||||
constructor() {
|
||||
this.assets = this.loadAssets();
|
||||
|
||||
this.connected = false;
|
||||
this.state = 'connecting';
|
||||
this.pingMode = 'fast';
|
||||
|
||||
this.input = new Input();
|
||||
this.net = new Net();
|
||||
this.world = new World();
|
||||
this.renderer = new Renderer();
|
||||
this.player = new Player();
|
||||
}
|
||||
|
||||
tick() {
|
||||
this.renderer.render(this.state);
|
||||
|
||||
var ship = this.world ? this.world.playerShip : false;
|
||||
|
||||
if(this.player.ship) {
|
||||
let delta = this.player.packDelta();
|
||||
if (delta)
|
||||
game.net.sendUpdate(delta);
|
||||
}
|
||||
|
||||
this.input.clear();
|
||||
|
||||
this.world.tick();
|
||||
|
||||
requestAnimationFrame(this.tick.bind(this));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue