Stencyl Extended Math
An extension for the game engine Stencyl that adds extra math functions to make math calculations easier.
Stencyl lacks a number of mathematical blocks that would have to be built from scratch for each game that uses functions like averages in a list, factorials, and logarithms of base n. This extension allows you to do these plus much more without building the math functions from scratch.
----- Constants -----
NaN
Returns a constant NaN which denotes not a number.
Infinity
Returns a constant which denotes the value of infinity.
Root 2
Returns the value of the square root of 2.
Phi
Returns Phi (the golden ratio) which is equal to (1 + √5)/2 ≈ 1.618
Maximum Bit Integers
Returns the maximum value of an 8, 16, 32, and 64 bit number.
----- Lists -----
Average, Max, Min values in List
Returns a specific number of the value of items in a given list which matches a desired characteristic.
Choices:
- Average
- Max
- Min
Intersection, Union and Subtraction of Lists
Returns a list with a desired modification given 2 lists.
Choises:
- Intersection: Returns a list of items found in both lists.
- Union: Returns a unique set of items found in all lists.
- Subraction: Returns the first list with all values from the second list removed in the first.
Subset
Returns true if every item is list A is also found in list B.
Summation
Returns the sum of all values in a given list.
Identity Matrix
Returns a matrix square of a given size with 1's along the diagonal
----- Math -----
Is Number
Returns true if a given value is a number.
Is Even/Odd
Returns whether or not a number is even or odd.
+/-
Returns a list of size 2 where the value of A + B is at index 0 and A - B is at index 1.
Inverse
Returns the inverse 1/N of a number.
Divides
Returns true if the first number evenly divides the second.
Modular Arithmatic
Returns true if the remainder of each of the first two numbers divided by the last are the same.
Cube Root
Returns the cube root of a number.
N-th Root
Returns the N-th root of a number
Log with Base
Returns the logarithm of a number with any base.
Factorial
Returns the factorial of a number. ie. (N)(N-1)(N-2)...(1)
Pick
Returns the factorial of a number to a given step. ie. (N)(N-1)(N-2)...(N-(k-1))
Choose
Returns ((N)!/(N-k)!)/(k)!
sinh, cosh, tanh
Returns sinh, cosh, or tanh.
~ sinh = (1/2) (-(1/e^N) + e^N)
~ cosh = (1/2) ((1/e^N) + e^N)
~ tanh = sinh(N)/cosh(N)
Implies
Returns false if the premise is true, but the outcome is false otherwise returns true.
Heaven Side Step
Returns 0 if the number given is 0, 1 if the number given is larger than 0, and -1 if the number given is less than 0.
----- Positional Space -----
Distance Between Actors
Returns the distance between 2 actors in the scene.
----- Geometry -----
Circle
Returns the area or circumerence of a circle with radius R.
Rectangle
Returns the area or parimeter of a rectangle with length L and width W.
Last Updated April 7, 2020 v1.0
Additional Notes: If you require additional math functions that are not included please let me know so I can add them
Contact Me: thejoblesscoder@gmail.com
Extension is Open Sourced and Licensed under MIT open source standards.