Boundries are what make up a level - they are the platforms, the colliders and the finishing lines. They are essentially just lines which make up the scene and allow many systems to work. As a matter of fact, all boundry functions use the term 'line' - mainly because its quicker to type and pluralises nicly.
There are 5 main types of boundry. There numerical references are used in scripts and load files.
- Type 0 - These are simple 'walls' and Bodies collide with them.
- Type 1 - These are killers, they kill bodies
- Type 2 - These are winners, they cause the Player (exclusivly) to win
- Type 3 - These are Planars, they cause Plane angle manipulation
- Type 4 - These do nothing by default, but can be used a triggers to do anything you want
There are a number of load functions for creating boundries, and they are explained below.
- line type x1 y1 x2 y2 - Creates a line of boundries 'type' between points (x1, y1) and (x2, y2)
- rect type x1 y1 x2 y2 - Creates a rectangle of boundries of type 'type' between points (x1, y1) and (x2, y2)
- circle type radius number x y - Creates a ring of boundries of type 'type', of radius 'radius' and with 'number' edges (eg. 4 would produce a quad) with centre (x, y)
- poly type x1 y1 x2 y2 x3 y3 x4... - Creates an open polygon of boundries following each x/y pair of type 'type'
- poly_closed type x1 y1 x2 y2 x3 y3 x4... - Creates a closed polygon of boundries following each x/y pair of type 'type'
Only line can be used to create Planars. The Planar angle is set just after the 'type' attribute.
Two types of boundry triggers exist in Planar, inkoved and passive. Invoked triggers are invoked by a the player hitting the spacebar, and passive ones by any body moving over something. You can set boundry trigger executions (they call exec functions) with these exec functions:
- set_line_trigger name code - Sets the boundry of name 'name' to execute 'code' when touched
- set_line_invoked_trigger name code - Sets the boundry of name 'name' to execute 'code' when invoked
Only one trigger can be set for any boundry, and calling either of the above exec functions referncing a boundry will overwrite the previous one. This can theoretically be worked around key mapping.
A number of exec functions exist to allow the movement of boundries:
- move_line name x y - Moves the boundry 'name' by (x, y)
- line_move_p1_to name dist x y - Moves the line by 'dist' in the x or y direction towards (x, y) relative to its primary point.
- line_move_p1_to name dist x y - Moves the line by 'dist' in the x or y direction towards (x, y) relative to its secondary point.
- set_line_loc x1 y1 x2 y2 - Sets the boundry points to the given (x1, y1) and (x2, y2) points without checking body contact.
All but the last of these functions will perform checks to see if a body is positioned on the boundry, and moves them accordingly if they are.