add start of grappling hook
This commit is contained in:
parent
ff0ac094cf
commit
4753f879e5
14 changed files with 192 additions and 69 deletions
|
@ -14,7 +14,7 @@ class World {
|
|||
this.copulae = new Set();
|
||||
this.structures = new Set();
|
||||
this.asteroids = new Set();
|
||||
this.missiles = new Set();
|
||||
this.projectiles = new Set();
|
||||
this.ships = new Map();
|
||||
this.players = new Set();
|
||||
this.room = room;
|
||||
|
@ -67,9 +67,10 @@ class World {
|
|||
this.addBody(asteroid);
|
||||
}
|
||||
|
||||
addMissile(missile) {
|
||||
this.missiles.add(missile);
|
||||
this.addBody(missile);
|
||||
addProjectile(projectile) {
|
||||
this.projectiles.add(projectile);
|
||||
this.addBody(projectile);
|
||||
projectile.connect();
|
||||
}
|
||||
|
||||
addBody(body) {
|
||||
|
@ -128,7 +129,7 @@ class World {
|
|||
this.ships.delete(body);
|
||||
this.structures.delete(body);
|
||||
this.asteroids.delete(body);
|
||||
this.missiles.delete(body);
|
||||
this.projectiles.delete(body);
|
||||
this.room.broadcast('destroy', body.id);
|
||||
}
|
||||
|
||||
|
@ -137,6 +138,10 @@ class World {
|
|||
this.room.broadcast('destroy', copula.id);
|
||||
}
|
||||
|
||||
weld(bodyA, bodyB) {
|
||||
this.physics.weld(bodyA, bodyB);
|
||||
}
|
||||
|
||||
start() {
|
||||
this.interval = setInterval(_ => this.tick(this), 1000 / 60);
|
||||
}
|
||||
|
@ -158,7 +163,7 @@ class World {
|
|||
|
||||
tickBodies(self.ships, 1);
|
||||
tickBodies(self.asteroids, 4);
|
||||
tickBodies(self.missiles, 1);
|
||||
tickBodies(self.projectiles, 1);
|
||||
|
||||
if (Date.now() - this.tpsStart > 5000) {
|
||||
this.tps = this.tpsCount / 5 | 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue