Add more modules

This commit is contained in:
asraelite 2018-03-07 19:00:03 +00:00
parent 0c63cb075b
commit 504f5fcc0c
18 changed files with 1448 additions and 11 deletions

View file

@ -23,6 +23,7 @@ export default class Ship extends Body {
this.cargoCapacity = 0;
this.thrust = 0;
this.crashed = false;
this.timeWithoutFuel = 0;
}
get com() {
@ -69,6 +70,13 @@ export default class Ship extends Body {
events.launchShip()
}
}
if (this.fuel === 0 && !state.gameOver) {
if (this.timeWithoutFuel++ > 300)
events.outOfFuel();
} else {
this.timeWithoutFuel = 0;
}
}
clearModules() {
@ -116,6 +124,8 @@ export default class Ship extends Body {
this.thrust += m.data.thrust;
} else if (m.type === 'gyroscope') {
this.rotationPower += m.data.rotation;
} else if (m.type === 'cargo') {
this.cargoCapacity += m.data.capacity;
}
});
}