Programs: 2path Conversion Utility


The 2path conversion utility "2path.exe" converts a text file that describes a path into an AGAST path resource. Path resources are used to limit an object's movement to a certain polygonal screen area, and to help navigate the shortest route between any two points int the path.

Since the compiler calls 2path, there is no need to execute the program directly.

Path Format

A path is simply a polygon composed of one or more triangles that share common sides and do not overlap. To define a path, you just have to create a text file to define each point and to define how those points connect to form the triangles.

A path source file is a plain text file that defines each. (The syntax completely unrelated to the AGAST programming language.) In the path file are point and triangle definitions. Each point and each triangle has an alphanumeric identifier and a set of attributes. No two points may have the same identifier, nor may any two traingles.

Points

This example shows three points:


point 1 { x=153 y=336 }
point 2 { x=251 y=374 }
point 3 { x=247 y=316 scale=0 color=255,128,0 alpha=10 z=10 }

The identifiers are 1, 2, and 3.

The x and y attributes are required for a point. They tell the position in the game's coordinate system (with the origin at the top left of the background, with x increasing right to left and y increasing top to bottom).

The rest of the attributes are optional.

Color is the RGB value of that point's color filter.

Alpha is the alpha-transparency intensity, where 0 is invisible, and 255 is opaque.

Z is the height the object will appear to be from the ground, so he can walk up small steps or in shallow holes (if the number is negative). [I don't think this is implemented yet.]

Scale is the objects scale size, where 0 is shrunk to nothing, and 1000 is full size.

Triangles


triangle 1 { points=1,2,3 }

A triangle just has an optional identifier ('1' in the above example) and a set of three points. During the game, whatever object is positioned in the triangle can take on the attributes of the three points used to compose that triangle.

For example, imagine one point is yellow and another is blue. If an object is a person, and walks from the yellow point to the blue point, he will take on a yellow tint, which will fade to green, and then to blue.

Command-Line

The command-line is used to pass the name of the input file. An input filename must have the pattern "*.path.txt", and the output file will then be called "*.path".

Errorlevels

2path returns an errorlevel 0 if and the input file is valid, and it successfully creates an output file.

See Also...