Hi @ayrin,
It looks like you tried to add an attribute to one of your scripts, but didn’t define what type it should be. Could you show the tiles attribute definition if you’re still having trouble after that explanation?
I hope this is helpful.
Uhm I don’t remember having added any attribute, maybe is a type error, i will check again the enemy script, is the last one i modified, hope it’s that one or find the error will become hell.
@eproasim it’s not the enemy script, maybe it’s the player script i have found this function but don’t see anything wrong (it worked before)
Player.prototype.visibleTiles= function(lv){
var tiles = [];
if (!tiles[lv]) {tiles[lv]=[];}
var self=this;
var lightPasses = function(x, y) {
var key = x+","+y;
var map = self.Root.script.level.map[lv];
var doors = self.Root.script.game.doorLocations[lv];
if (key in map) {
//Can't pass through doors
if(doors[key] && doors[key].closed){
return false;
}
//Light can pass through here
return true;
}
return false;
};
var fov = new ROT.FOV.PreciseShadowcasting(lightPasses);
var floors = this.Root.script.game.floorLocations[lv];
var enemies = this.Root.script.game.enemyLocations;
fov.compute(this.x, this.y, this.visibilityRange, function(x, y, r, visibility) {
//Only return tiles which were not already visible or has enemy
var floor = floors[x+','+y];
if(!floor || !floor.enabled || enemies[x+','+y]){
tiles[lv].push(x+','+y);
}
});
return tiles;
};
