Add more modules
This commit is contained in:
parent
0c63cb075b
commit
504f5fcc0c
18 changed files with 1448 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue