Pathfinding

Started by GoodMorning, September 24, 2016, 12:14:21 AM

Previous topic - Next topic

GoodMorning

The following script is "acting up". The entity that it creates has a "tail" following a "head". The "head" runs the controlling script.

However, the movements of the head dictate the path of the entire thing, and are not impacted by the body.

My issue is that the head will wander onto void, despite efforts to the contrary. For the most part, using angular direction and velocity keeps it on-map, but occasionally it will wander off the edge or onto internal Void.

The theory is that it will find a target cell to move to, and go there in a direct line. If that cell is void, it will test to see if progressively larger turns are not on void, eventually turning entirely around. (AC should also be invalid)

Centipede.crpl is for the "head", manually attached. DestroyOnRecompile.crpl will be automatically attached to the body segments, and has no purpose except to keep the map tidy. The image should go in the Custom0 slot, making the entire thing visible.

Could someone have a look at it? I have done so, but having written it, I may well be overlooking some trifling error. The script is useless until the enemy cannot wander out of bounds and never be seen again, rendering completion impossible.
A narrative is a lightly-marked path to another reality.