Game (functions)/Direction: Difference between revisions
From PMDOWiki
Created page with "== GAME:VectorToDirection(RogueElements.Loc) == Turns a vector (preferably a unit vector) into a cardinal or diagonal direction. === Arguments === * <code>v</code>: The vector. === Returns === The direction as one of 8 values. == GAME:VectorToDirection(System.Double,System.Double) == Convenience function to get a vector's components from lua numbers(doubles) === Arguments === * <code>X</code>: The X value of the vector * <code>Y</code>: The Y value of the ve..." |
No edit summary |
||
| Line 1: | Line 1: | ||
== | == VectorToDirection == | ||
Returns either an integer or a vector as an 8-directional direction. | |||
=== Context 1 === | |||
Takes in an integer. | |||
{| class="wikitable" | |||
{{ArgHeader}} | |||
{{ArgRow | |||
|name=num | |||
|type=Integer | |||
|techt=System.Int32 | |||
|purp=The integer to convert to a direction. | |||
}} | |||
|} | |||
=== Context 2 === | |||
Takes in two doubles and finds the closest direction to that vector. | |||
=== | {| class="wikitable" | ||
{{ArgHeader}} | |||
{{ArgRow | |||
|name=x | |||
|type=Double | |||
|techt=(undocumented) | |||
|purp=The X value of the vector | |||
}} | |||
{{ArgRow | |||
|name=y | |||
|type=Double | |||
|techt=(undocumented) | |||
|purp=The Y value of the vector | |||
}} | |||
|} | |||
== RandomDirection == | |||
Generates a random direction. Returns an 8-directional direction. | |||
Generates a random direction. | |||
Latest revision as of 00:20, 18 January 2026
VectorToDirection
Returns either an integer or a vector as an 8-directional direction.
Context 1
Takes in an integer.
| Name | Type | Technical Type | Purpose |
|---|---|---|---|
| num | Integer | System.Int32
|
The integer to convert to a direction. |
Context 2
Takes in two doubles and finds the closest direction to that vector.
| Name | Type | Technical Type | Purpose |
|---|---|---|---|
| x | Double | (undocumented)
|
The X value of the vector |
| y | Double | (undocumented)
|
The Y value of the vector |
RandomDirection
Generates a random direction. Returns an 8-directional direction.
