add basic game classes
This commit is contained in:
parent
ebcee954bf
commit
bb9a493450
11 changed files with 137 additions and 6 deletions
35
server/game/room/world/index.js
Normal file
35
server/game/room/world/index.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
const Ship = require('./ship.js');
|
||||
|
||||
class World {
|
||||
constructor() {
|
||||
this.box2d = false;
|
||||
this.bodies = new Set();
|
||||
this.structures = new Set();
|
||||
this.asteroids = new Set();
|
||||
this.ships = new Map();
|
||||
this.players = new Set();
|
||||
}
|
||||
|
||||
addPlayer(player) {
|
||||
this.players.add(player);
|
||||
this.ships.set(player, new Ship(player));
|
||||
}
|
||||
|
||||
removePlayer(player) {
|
||||
removeBody(player.ship);
|
||||
this.ships.delete(player);
|
||||
this.players.delete(player);
|
||||
}
|
||||
|
||||
removeBody(body) {
|
||||
// Remove from Box2d.
|
||||
}
|
||||
|
||||
tick() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = World;
|
Loading…
Add table
Add a link
Reference in a new issue