If(player above) find nearest lader
if(player below find nearest lader or edge to jump off
if(player on same level) try to close X
As you pointed out the try to close X is not smart. Do you have any suggestions on how to make it a bit smarter with out adding too much code.
if(player below find nearest lader or edge to jump off
if(player on same level) try to close X
As you pointed out the try to close X is not smart. Do you have any suggestions on how to make it a bit smarter with out adding too much code.
I think carefully in the question:
- The most effective way is to add some backtraking to search the best ladder to reach player. Probably from player so you solve all the directions of all the enemies in "one step". But, yes, this add some code.
- Other solution: remember last lader used by each enemy and check if the level of the enemy continue bellow/above the level of player for some amount of time/ticks (or distance of player, or some sort of this). Then use another lader when search for the nearest lader. Not sure if this works.
- One more solution: add areas to the map definition.Imagine you add 8 bits x cell. Each bit indicates an area in the map. So, you check the player cell and determines he is in the area 3 (3th bit set). Then you known the emeny must go to the lader that have a 3th bit in its cell to reach the player. This reduces the number of levels (but compression must do its job and finally the bytes diff must be minimal).
Good luck


, 
