add basic missiles

This commit is contained in:
Asraelite 2016-03-24 18:42:11 +00:00
parent 21a30ad212
commit ac089f3e8e
19 changed files with 215 additions and 85 deletions

View file

@ -4,7 +4,6 @@ class World {
constructor() {
this.bodies = {};
this.playerShip = false;
this.playerShipId = false;
this.physics = new Physics();
this.bounds = {
@ -37,6 +36,7 @@ class World {
if (data.type == 'asteroid') body = new Asteroid(data);
if (data.type == 'ship') body = new Ship(data);
if (data.type == 'structure') body = new Structure(data);
if (data.type == 'missile') body = new Missile(data);
//if(data.type == 'ship') console.log(body);
@ -59,8 +59,6 @@ class World {
};
update(data) {
this.playerShip = this.bodies[this.playerShipId];
for (var id in data) {
if (!this.bodies[id]) {
game.net.send('requestBodyData', id);
@ -74,6 +72,11 @@ class World {
}
};
setPlayerShip(id) {
this.playerShip = this.bodies[id];
game.player.ship = this.playerShip;
}
tick() {
this.physics.step();