|
Path Modes are the hard-coded movement modes which E02 uses to move the player based on his Velocities
and test for collision against objects and level tile planes. These modes are the first part of the Movement Phase,
and occur before the scripted Movement Mode handling, which are responsible for all other player control functionality.
The velocities by which the player is moved are "fixed-point" values, meaning that they are whole numbers that describe whole and partial pixel movement
counts. This value allows for 256 units of partial movement before the player is moved one unit across the screen, which means that the number of whole
pixels that the player will move is velocity/256, or velocity>>8. At the beginning of player movement, the current X and Y Velocities are added to the
Count variables, which are used as counters while the player moves one whole pixel unit through the
level at a time. After each unit of movement, the player tests for collisions with the current solid level plane,
runs the scripted collision functions for each active game object, and removes 256 (one whole pixel unit) from the counter, until there are less
than 256 units of velocity left, which are left in the counter until the next frame. This method allows for smooth acceleration when the player's velocity is increased
by units less than 256 (one pixel), since partial units of velocity are preserved between game frames, and collision testing for every whole unit of motion
allows for finer collision testing, allowing the player to react to collision at the exact moment that it happens (during player movement, though not during
object movement)
The player's velocities are made up of the X and Y "component velocities",
and the "Path"/Vector velocity. The "Path Velocity" is the speed at which the player is moving along a path, or in freespace.
When the player is flagged for "vector movement", the Path Angle
is used to break the Path Velocity into the component X and Y velocities, which are used as described above. When not
using vectored movement, or when in freespace, the full Path Velocity value is used as the player's speed based on the current Path Mode in the following way:
Floor: X = Path, y = y
Ceiling: X = -Path, y = y
LWall: Y = Path, x = x
RWall: Y = -Path, x = x
Other: x = x, y = y
There are 9 valid Path Mode settings that control in what direction collisions are processed:
0 - Floor Path
|
This mode tests for level collision below the player. If flagged to do so,
crossing 45-degree angles while on this path will transition to either the Left or Right wall mode. Level Collision is read
using the MainBound box in normal orientation
|
1 - Right Wall Path
|
This mode tests for level collision to the right of the player. If flagged to do so,
crossing 45-degree angles while on this path will transition to either the Floor or Ceiling wall mode. If the player is flagged
to use rotated MainBounds, collision is read with the box rotated 90-degrees clockwise
|
2 - Left Wall Path
|
This mode tests for level collision to the left of the player. If flagged to do so,
crossing 45-degree angles while on this path will transition to either the Floor or Ceiling wall mode. If the player is flagged
to use rotated MainBounds, collision is read with the box rotated 90-degrees counterclockwise
|
3 - Ceiling Path
|
This mode tests for level collision above the player. If flagged to do so,
crossing 45-degree angles while on this path will transition to either the Left or Right wall mode. If the player is flagged
to use rotated MainBounds, collision is read with the box rotated 180-degrees
|
4 - No Collision
5 - No Collision
6 - No Collision
7 - No Collision
|
These modes do not test for collision with the level or with objects, and "Path Velocity" has no effect
|
8 - Debug Mode
|
This mode functions the same as the "No Collision" modes, except that the player's image is replaced by an image
representing the currently-selected debug object, based on the object's debug draw function
|
Each of the first four Path Modes are made up of two parts:
- Path Tracer
|
When a player is connected to a "Path" (A level plane, a Solid Tiled Object or a Solid Object), he is
moved by the Path Tracer. The Path Tracer moves the player along the path based on his Path Velocity,
as described above. The player is moved along the path at the speed designated by the component velocity on the axis
that corresponds with his current path mode. The player is moved one pixel at a time along the path as described above,
ignoring velocity on the other axis, as it is only representative of the rise or fall of the path itself, so the player is moved up or down according
to the shape of the solid path, as long as the difference in height is equal to or less than the Slope Tolerance settings. If a rise
is greater than the tolerance, the path ahead is regarded as a wall, and the player is stopped. If a drop is greater than the tolerance, it is regarded
as the end of the path, at which point the player "disconnects" from the path and enters Freespace, unless object collisions have also set the player as
standing on a solid object. This mode only affects the player if he is flagged to follow paths
|
- Freespace Movement
|
When a player is not connected to a "Path", he is considered to be in "Freespace". Path Velocity
is still used as described above, but both component velocities are used to move the player along a diagonal line.
The player is moved one unit at a time along the diagonal line, testing for object and level collisions along the way. When the player strikes
level solidity or a solid object in the direction of his current Path Mode, he "connects" to the path and enters "Path Tracer" mode, but only if he is flagged to follow paths. While still
in Freespace, if the player is moving "forward" or "backward" relative to his Path Mode without moving "up", and strikes solidity from the "ceiling",
the player is moved down by the difference between the "upper" portion of his MainBounds, and the lowest point of the "ceiling"'s solidity if the
difference is less than or equal the Slope Tolerance settings. If the difference is greater, the solidity is treated as a "wall", and
the player's movement in that direction is stopped. To prevent any level collision from occurring at all, the player's Solid Plane
can be set equal to the ID of a tile plane that has no solidity
|
|