isPathClear bug or code problem?


#1

isPathClear return false in case
now the path is clean but was blocked before
in my case it is fire trap even after they detonate isPathClear return false

while (true) {

hero.move({x:40, y:35});

var enemies = hero.findEnemies();
var trap = hero.findHazards();

	for (var enemy_i = 0; enemy_i < enemies.length; enemy_i++) {
		var enemy = enemies[enemy_i];

		if (enemy.pos.x > 61 && 
			hero.isPathClear({x:54, y:35}, {x:62, y:35})) {
			hero.buildXY("fence", 54, 35);
		}
		if (enemy.pos.x < 26 &&
			hero.isPathClear({x:26, y:35}, {x:17, y:34})){
			hero.buildXY("fence", 26, 34);
		}
		if (enemy.pos.y > 50) {					
//			hero.say(hero.isPathClear({x:40, y:47}, {x:40, y:53}) + " top");

			if (hero.isPathClear({x:40, y:47}, {x:40, y:53})){
				hero.buildXY("fire-trap", 40, 50);
			}
		}
		if (enemy.pos.y < 21) {				
//			hero.say(hero.isPathClear({x:40, y:24}, {x:40, y:17}) + " bot");

			if (hero.isPathClear({x:40, y:24}, {x:40, y:17})){
				hero.buildXY("fire-trap", 40, 20);
			}
		}		
	}
}