Cache tile properties at map load time instead of parsing them every time we shoot a vision ray
This commit is contained in:
@@ -61,6 +61,14 @@ GameState.prototype.create = function()
|
||||
}
|
||||
}
|
||||
|
||||
this.map_collision_layers.forEach(function(layer) {
|
||||
layer.layer.data.forEach(function(row) {
|
||||
row.forEach(function(column) {
|
||||
setTileProperties(column);
|
||||
}, this);
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
pathfinder_grid = new PF.Grid(this.map.width,
|
||||
this.map.height,
|
||||
pfgrid);
|
||||
|
||||
@@ -347,7 +347,6 @@ function tilesFromCollisionLayers(x, y)
|
||||
var res = [];
|
||||
layers.forEach(function(layer) {
|
||||
var tile = layer.getTiles(x, y, 1, 1)[0];
|
||||
setTileProperties(tile);
|
||||
res.push(tile);
|
||||
}, this);
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user