add ship destruction
This commit is contained in:
parent
44ddaacb15
commit
d9e8e217c6
5 changed files with 47 additions and 12 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue