Add more planets
This commit is contained in:
parent
504f5fcc0c
commit
6cad5551bb
13 changed files with 748 additions and 23 deletions
|
@ -17,7 +17,6 @@ export function init() {
|
|||
clear();
|
||||
spawn.player();
|
||||
let p = spawn.startPlanet();
|
||||
spawn.testEntity(p);
|
||||
spawn.tick();
|
||||
}
|
||||
|
||||
|
|
|
@ -223,10 +223,13 @@ export default class Ship extends Body {
|
|||
|
||||
this.applyDirectionalForce(0, thrustForce, turnForce);
|
||||
|
||||
if (Math.abs(this.rvel) > 0.1) {
|
||||
this.rvel *= 0.7;
|
||||
}
|
||||
|
||||
this.modules.forEach(m => {
|
||||
if (m.type !== 'thruster' || thrustForce == 0) return;
|
||||
m.power += forward;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,18 +139,19 @@ export function player() {
|
|||
}
|
||||
|
||||
export function startPlanet() {
|
||||
return randomPlanet(0, 0, {
|
||||
let planet = randomPlanet(0, 0, {
|
||||
radius: 40,
|
||||
density: 3,
|
||||
type: 'green'
|
||||
});
|
||||
let fuel = new Entity(0, 0, 'fuelcan');
|
||||
world.entities.add(fuel);
|
||||
fuel.orbit(planet, 10, -0.5);
|
||||
return planet;
|
||||
}
|
||||
|
||||
export function testEntity(parent) {
|
||||
let entity = new Entity(0, -50);
|
||||
world.entities.add(entity);
|
||||
entity.orbit(parent, 10);
|
||||
return entity;
|
||||
export function startEntity(parent) {
|
||||
|
||||
}
|
||||
|
||||
export function celestial(x, y, radius, params) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue