add ship destruction

This commit is contained in:
Asraelite 2016-03-30 19:58:56 +01:00
parent 44ddaacb15
commit d9e8e217c6
5 changed files with 47 additions and 12 deletions

View file

@ -37,15 +37,7 @@ class World {
addPlayer(player) {
this.players.add(player);
let pos = {
x: player.team == 'b' ? this.bounds.right - 5 : 5,
y: this.bounds.bottom / 2
};
let ship = new Ship(this, pos, player);
player.ship = ship;
this.addShip(ship);
//this.test();
this.spawner.spawnShip(player);
}
test() {
@ -173,6 +165,11 @@ class World {
tick() {
this.physics.step();
this.players.forEach(player => {
if (!player.ship)
this.spawner.spawnShip(player);
});
let tickBodies = (set, interval, forceInterval) => {
set.forEach(body => {
let force = this.tickCount % forceInterval == 0;