Introduction:
Actors in scenes does not know its surroundings. However, the information can be given to actors in form of bitmap data or perimeter data. Otherwise actors have to be programmed to scan surroundings and generate perimeter data.
Actors in scenes does not know its surroundings. However, the information can be given to actors in form of bitmap data or perimeter data. Otherwise actors have to be programmed to scan surroundings and generate perimeter data.
In this case, the scene needs to have 2 or more layers. Layer 0: paths and Layer 1: unwalkable areas.
Optionally, it can begin with tile data in array form. In this case, vertical scan E means path tile exists while B means path tile does not in layer 0. The behavior can be added to any actors that process tile data to perimeter data,
After the forming the tile data, The scene behavior does not have to go through Stencyl engine to scan for tile for the next step. Instead it will be using basic functions specifically, loading from an array thus reduce resource required.
To start with path finding, The surrounding has to be scanned then the information obtained has to be processed. In this case, bitmap data to perimeter data.
Bitmap data to perimeter data has few large steps. The first one is to determine the amount of entry the scenes have. Each entry to the scene will add one continuous set of straight lines between the walkable area and the restricted area. The minimum amount of these continuous lines is the amount of entries in this scenes and that is without the restricted area enclosed by walkable area.
In this case, the bitmap data is processed from the upper-left corner clockwise. this event has 4 steps each step accounts for 1 edge of the scene. Each entry to the scene will add one catchpoint thus the number of continuous lines between walkable area and restricted area.
the map_edge is for diagnosis purposes only which is to help debugging during development of this event.
The next step is to generate the perimeter data starting from the catchpoints where each continuous line between the walkable area and the restricted area starts. in this case, starting with the upper left corner clockwise.
If this is very complicated for you, the event above does not account for the restricted area enclosed by walkable area but only the restricted area . The fillblack event is does not account for that either but rather fills black tile at layer 1 wherever the tiles at layer 0 is absent.
here is the diagnostic event which is not to be used when not testing that helped Stencyl-nator to make it this far Stencyl-nator: diagnosis (debug) drawing. (stencyl-nator.blogspot.com) .
The next step will be the restricted area enclosed by walkable area.
No comments:
Post a Comment