I'm impressed at the performance of this, compared to event-based field of view. However, there are a number of bugs with pathfinding. I've modified your demo to demonstrate: here.
You can cause a crash a number of different ways:
-Place a second instance of the Enemy object.
-Require the Enemy to find a new path as often as it moves.
-Right-clicking excessively will eventually cause a crash. This usually happens when the Enemy is adjacent to a Blocker object (orthogonally or diagonally) even when the object is not in the way of the path. Oddly enough, this never becomes an issue if you control the player with the arrow keys.
There are also some unexpected behaviors which, although not exactly bugs, would still be considered unexpected:
-The behavior assumes all objects are equal to the grid size. This becomes an issue e.g. if using a tiled background for the walls.
-In some cases, the behavior thinks the object for which fov is being calculated is inside a wall. I haven't yet been able to reproduce this outside of one project, but one solution is to ignore the tile the object is currently occupying.
Thanks for this seven.
I'll have a look. With regards to tile size are you saying to calculate the cells that are blocked based on the dimension of the object rather than position and tile size?
The wall thing occurs when you place the "player" on top of a cell that is blocked didn't think it blocked itself?
Working on the pathfinding <img src="smileys/smiley5.gif" border="0" align="middle">