add rope support
This commit is contained in:
parent
ccc77490ea
commit
ff0ac094cf
7 changed files with 91 additions and 19 deletions
|
@ -41,6 +41,20 @@ class World {
|
|||
let ship = new Ship(this, pos, player);
|
||||
player.ship = ship;
|
||||
this.addShip(ship);
|
||||
|
||||
//this.test();
|
||||
}
|
||||
|
||||
test() {
|
||||
if (this.players.size == 2) {
|
||||
let b1 = Array.from(this.players)[0].ship;
|
||||
let b2 = Array.from(this.players)[1].ship;
|
||||
|
||||
let copula = new (require('./copula/rope.js'))(b1, b2);
|
||||
if (b1 != b2) {
|
||||
this.physics.createCopula(copula);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addShip(ship) {
|
||||
|
@ -100,14 +114,6 @@ class World {
|
|||
};
|
||||
this.spawner.spawnAsteroid(pos.x, pos.y,Math.random() * 50 + 10);
|
||||
}
|
||||
|
||||
let a1 = Array.from(this.asteroids)[Math.random() * this.asteroids.size];
|
||||
let a2 = Array.from(this.asteroids)[Math.random() * this.asteroids.size];
|
||||
|
||||
let copula = new (require('./copula/copula.js'))(a1, a2);
|
||||
if (a1 != a2) {
|
||||
this.physics.createCopula(copula);
|
||||
}
|
||||
}
|
||||
|
||||
removePlayer(player) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue