Skip to content

MockPlayer

Syyrion edited this page Feb 22, 2023 · 9 revisions

The MockPlayer Class is an extension class of the PolyWall class but is more advanced than other extensions.

MockPlayers are non-solid fake players that can be customized and transformed. The MockPlayer class is an extension class, similar to the parameter classes, but is much more advanced and behaves in a similar way to the PolyWall class as it contains its own layer system. However, the MockPlayer class has no ability to create or destroy these layers as that is only reserved for the PolyWall class. In practice, the PolyWall class ensures that the layer system of its MockPlayer extension is exactly the same as itself. This layer system is used so that MockPlayer functions can also be recursive.

Special Objects

  • MockPlayer[i][j] ... [k][l]

    • Directly indexing a layer with a number returns the corresponding MockPlayer sublayer. If there is no sublayer, indexing returns nil. This can be chained repeatedly to access any MockPlayer layer from the current layer.
  • MockPlayer.L

    • A table of all sublayers of the current layer. This isn't usually used in practice since directy indexing a MockPlayer class with a number returns the corrsponding sublayer.
  • MockPlayer.W

    • A table of all MockPlayers contained in the current layer. Every MockPlayer has a unique table as a key and a primitive layer as its value.

This is very similar to how the PolyWall class stores its walls.

Parameters

  • MockPlayer.angle
    • The MockPlayer angle.
    • This is a cascading numeric class.
    • Its default value is defined by the actual player angle.
  • MockPlayer.offset
    • The MockPlayer angle offset.
    • This is a cascading numeric class.
    • Its default value is 0.
  • MockPlayer.distance
    • The distance from the center to the tip of the MockPlayer triangle.
    • This is a cascading numeric class.
    • Its default value is defined by the distance from the center to the tip of the actual player.
  • MockPlayer.height
    • Height of the MockPlayer triangle.
    • This is a cascading numeric class.
    • Its default value is defined by the actual player height.
  • MockPlayer.width
    • With of the MockPlayer triangle.
    • This is a cascading numeric class.
    • Its default value is defined by the actual player width.
  • MockPlayer.vertex

IMPORTANT: Vertex 3 of this class is unused by the MockPlayer class as a MockPlayer is always a triangle and thus does not need the information of all 4 verticies of the QuadVertex class.

IMPORTANT: The MockPlayer vertex class inherits its values from the PolyWall class that it extends, NOT the previous MockPlayer layer

Functions

Recursive functions are marked with an asterisk (*). For more details on how they work visit PolyWall.

  • MockPlayer:construct(parent, a0, ofs, d, h, w, r, g, b, a, pol, cart, col)
    Creates the most primitive layer object. In practice, this is only used by MockPlayers which don't need all features of an actual layer. This object lacks the ability to create new layers.

    Parameter Initializations

    The arguments of this function are used to initialize the parameter classes with certain values and are listed below:

    Name Parameter
    <parent> The object from which the new vertex class will inherit from.
    <a0> angle
    <ofs> offset
    <d> distance
    <h> height
    <w> width
    <r> Red channel (all verticies)
    <g> Green channel (all verticies)
    <b> Blue channel (all verticies)
    <a> Alpha channel (all verticies)
    <pol> Polar transformation (all verticies)
    <cart> Cartesian transformation (all verticies)
    <col> Color transformation (all verticies)
  • MockPlayer:new(parent, a0, ofs, d, h, w, r, g, b, a, pol, cart, col)
    Creates a new standalone layer. This layer is disconnected from its superclass layer but still inherits its values. In practice, it is indirectly used when the PolyWall class creates layers to ensure that the MockPlayer layer structure is identical to itself.

  • MockPlayer:create(depth, ...) *
    Creates a MockPlayer. If the depth parameter is 0, returns the MockPlayer object and its key.

  • MockPlayer:wremove(key)
    Removes a MockPlayer with key <key>.
    Legacy name: rmWall

  • MockPlayer:wxremove(depth) *
    Removes all MockPlayers.
    Legacy name: rrmWall

  • MockPlayer:move(depth, mFocus) *
    Updates the location of MockPlayers. If <mFocus> is true, MockPlayers will be shrunk accordingly. Any polar and cartesian transformations are also applied, in that order.

  • MockPlayer:fill(depth) *
    Updates MockPlayer colors. Any color transformations applied.

  • PolyWall:run(depth, mFrameTime) *
    Union of move and fill. Color transformations applied by this function have access to polar and cartesian coordinate information. A more detailed description of this functionailty is provided in Transformations.

Clone this wiki locally