I made a map based off the original -UPDATED IT BECAUSE IT WAS TOO NARROW forget-
function Game() {
this.clients = [];
this.entities = {};
this.nextEntity = 0;
var map = [
" ########################### ",
" #....#######.....##......G# ",
" #..........#GGG#.##......G# ",
" #...###....#..G#.....###.## ",
" #..##....#.#G..#.#######.#### ",
" #......###.#GGG#.######.....# ",
" #..............#........###.# ",
" #....#####.#####.........#..# ",
" #.................##..##...## ",
" #....########.############### ",
" #...###### #............# ",
" #......### #.........#..# # # ",
" #..##....# #.........#..# ",
" #..####..# #.#....##.#..# # # ",
" #........# #.#....##....# ### ",
" #..##.#### #.#..........## ",
" #.....# #.#....####....#######",
" #..#..# #.##..######.......###",
" #..#..#######.#G..G....#..#......#",
" #..#..#GGG....#GG...GG.#..#......#",
" #..#...GGG....###.####.#..#..##..#",
" #..####GGG..#.....#.......#......#",
" #...........#....##.......#......#",
" #.............#..##.#####.#......#",
" #..#######....#...........###..###",
" #...........###...........#......#",
" #..###########............#GG##GG#",
" #...............##################",
" #...............# ",
" ################# "
];
this.world = {
w: map[0].length,
h: map.length,
data: map,
get: function (x, y) {
return this.data[y][x];
}
};
new entity.Goblin(this, {x: 3, y: 2});
new entity.Slime(this, {x: 14, y: 13});
this.update();
}
Game.prototype.message = function (message) {
for (var i = 0; i < this.clients.length; ++i) {
this.clients[i].message(message);
}
}
Game.prototype.update = function () {
for (var i = 0; i < this.clients.length; ++i) {
this.clients[i].update();
}
for (var key in this.entities) {
this.entities[key].update();
}
setTimeout(this.update.bind(this), 1000 / 30);
};
module.exports = Game;
:(