--- upstream/scripts\main.js +++ browser/scripts\main.js @@ -27,7 +27,7 @@ }; this.levelIndex = 0; - this.map = new Map(this.game, this.groups.bg, levels[this.levelIndex].level); + this.map = new VikingMap(this.game, this.groups.bg, levels[this.levelIndex].level); this.player = new Player(this.game, this.map.getBed(), @@ -103,7 +103,7 @@ this.levelIndex = i; if (this.levelIndex < levels.length) { this.map.stop(); - this.map = new Map(this.game, this.groups.bg, levels[this.levelIndex].level); + this.map = new VikingMap(this.game, this.groups.bg, levels[this.levelIndex].level); this.dialog.setTexts(levels[this.levelIndex].texts); this.dialog.alpha = 1; } else { --- upstream/scripts\map.js +++ browser/scripts\map.js @@ -1,4 +1,4 @@ -var Map = function(game, group, mapName) { +var VikingMap = function(game, group, mapName) { this.map = game.add.tilemap(mapName); this.map.addTilesetImage('Tiles', 'tiles_light'); this.layerBack = this.map.createLayer('Background'); @@ -40,7 +40,7 @@ } }; -Map.prototype.reset = function() { +VikingMap.prototype.reset = function() { // Make sure we are at night if (this.currentTileIndex != 1) { this.switchTiles(); @@ -69,7 +69,7 @@ this.after.dirty = true; }; -Map.prototype.switchTiles = function() { +VikingMap.prototype.switchTiles = function() { if (this.sounds[this.currentTileIndex].isPlaying) { this.sounds[this.currentTileIndex].stop(); } @@ -82,7 +82,7 @@ }; // Count the number of tiles that satisfy a condition -Map.prototype.countTiles = function(layer1, layer2, cond) { +VikingMap.prototype.countTiles = function(layer1, layer2, cond) { var count = 0; var tiles1 = layer1.getTiles(0, 0, layer1.width, layer1.height); var tiles2 = layer2.getTiles(0, 0, layer2.width, layer2.height); @@ -96,7 +96,7 @@ // Get the position of the bed // So we can place the player here -Map.prototype.getBed = function() { +VikingMap.prototype.getBed = function() { var beds = this.bed.getTiles(0, 0, this.bed.width, this.bed.height); for (var i = 0; i < beds.length; i++) { if (beds[i].index >= 0) { @@ -107,12 +107,12 @@ return null; }; -Map.prototype.isRealWall = function(grid) { +VikingMap.prototype.isRealWall = function(grid) { var wall = this.map.getTile(grid.x, grid.y, this.walls); return wall !== null && wall.index >= 0; }; -Map.prototype.isWall = function(grid) { +VikingMap.prototype.isWall = function(grid) { if (this.isRealWall(grid)) { return true; } @@ -124,7 +124,7 @@ }; // Returns tile indices for before, after -Map.prototype.destroyAt = function(grid, dir) { +VikingMap.prototype.destroyAt = function(grid, dir) { var object = this.map.getTile(grid.x, grid.y, this.after); var isWall = this.isWall(grid); // Can only destroy wall-mounted objects from below @@ -147,7 +147,7 @@ }; // Returns tile indices for before, after -Map.prototype.restoreAt = function(grid, dir) { +VikingMap.prototype.restoreAt = function(grid, dir) { var object = this.map.getTile(grid.x, grid.y, this.after); var isWall = this.isRealWall(grid); // Can only destroy wall-mounted objects from below @@ -169,6 +169,6 @@ return [-1, -1]; }; -Map.prototype.stop = function() { +VikingMap.prototype.stop = function() { this.sounds[this.currentTileIndex].stop(); };