15 actions in the Math category.
Each block mirrors how the action appears in the editor's sidebar.
Angle Difference
Every Frame
Angle DifferenceMath
From0.0|To0.0
Measures how far one angle is from another, always taking the short way around. From 350 to 10 degrees it answers 20 instead of -340, which is what stops a turning node from spinning the long way. A negative answer means turning the other way.
Input
Type
Default
Description
From
float
0.0
The current angle, in degrees.
To
float
0.0
The target angle, in degrees.
Output
Type
Description
Result
float
How far to turn, in degrees, negative when the short way is the other way.
PhasesStartEvery FramePhysicsEnd
Clamp
Every Frame
ClampMath
Value0.0|Min0.0|Max1.0
Keeps a value inside a range, so it never goes below Min or above Max.
Input
Type
Default
Description
Value
Variant
0.0
The value to limit.
Min
Variant
0.0
The lowest allowed value.
Max
Variant
1.0
The highest allowed value.
Output
Type
Description
Result
Variant
The clamped value.
PhasesStartEvery FramePhysicsEnd
Combine Numbers
Every Frame
Combine NumbersMath
Function'min'|A0.0|B0.0
Applies a two-number math function to A and B, such as min, max or pow.
Input
Type
Default
Description
Function
String
'min'
min keeps the smaller of the two, max the bigger, pow raises A to the power of B, snapped rounds A to steps of B, and fmod gives the remainder of A divided by B.
A
Variant
0.0
The first number.
B
Variant
0.0
The second number.
Output
Type
Description
Result
Variant
The function result.
PhasesStartEvery FramePhysicsEnd
Figure Eight
Every Frame
Figure EightMath
Speed1.0|Reach1.0
Gives two numbers that together trace a sideways figure eight, Side swinging once across while Rise swings twice. With Speed = 2 the eight is drawn twice a second, and adding both to a position makes a firefly loop or an idle character sway. Oscillate rides the game clock, so changing its Frequency jumps the value, while this one keeps its own count and can speed up without a jump.
Input
Type
Default
Description
Speed
float
1.0
How many full eights are drawn each second.
Reach
float
1.0
How far the eight reaches sideways, with Rise reaching half of that. A Spring To value here makes the motion grow and shrink smoothly instead of switching on and off.
Output
Type
Description
Side
float
Where to store the side to side offset, which swings once per eight.
Rise
float
Where to store the up and down offset, which swings twice per eight and is what bends the path into an eight.
PhasesEvery FramePhysics
Lerp
Every Frame
LerpMath
From0.0|To1.0|Weight0.5
Blends between two values by a weight, where 0 gives From, 1 gives To and 0.5 gives the value right in the middle.
Takes a number that lives in one range and gives the matching number in another range. Health from 0 to 100 with an Out range of 0 to 1 becomes the fill of a health bar, so 30 health gives 0.3. A value outside the In range is held at the closest end.
Input
Type
Default
Description
Value
float
0.0
The number to rescale.
In Min
float
0.0
The lowest value the input can take.
In Max
float
1.0
The highest value the input can take.
Out Min
float
0.0
The value returned when Value is at In Min.
Out Max
float
1.0
The value returned when Value is at In Max.
Output
Type
Description
Result
float
The rescaled value, clamped to the Out range.
PhasesStartEvery FramePhysicsEnd
Math
Every Frame
MathMath
A0|Operator'+'|B0
Combines two numbers with an arithmetic operator, such as add or multiply.
Input
Type
Default
Description
A
Variant
0
The left-hand number.
Operator
String
'+'
The arithmetic operation to apply. The remainder only works on whole numbers.
B
Variant
0
The right-hand number.
Output
Type
Description
Result
Variant
The result of the operation.
PhasesStartEvery FramePhysicsEnd
Number Function
Every Frame
Number FunctionMath
Function'abs'|Value0.0
Applies a single-number math function to Value, such as abs or sqrt.
Input
Type
Default
Description
Function
String
'abs'
abs drops the minus sign, sign answers -1, 0 or 1, round, floor and ceil turn a decimal into a whole number, and sqrt gives the square root.
Value
Variant
0.0
The number to feed into the function.
Output
Type
Description
Result
Variant
The function result.
PhasesStartEvery FramePhysicsEnd
Oscillate
Every Frame
OscillateMath
Frequency1.0|Amplitude1.0
Gives a number that swings smoothly up and down forever, driven by the game clock. With Amplitude = 10 it travels between -10 and 10, and Frequency = 2 makes it do that twice a second. Add it to a position for a coin that bobs or a light that pulses.
Input
Type
Default
Description
Frequency
float
1.0
How many full up-and-down trips happen each second.
Amplitude
float
1.0
How far it reaches from the middle, in each direction.
Output
Type
Description
Result
float
The current wave value.
PhasesStartEvery FramePhysicsEnd
Ping Pong
Every Frame
Ping PongMath
Value0.0|Length1.0
Makes a number climb up to Length and then walk back down to 0, over and over. Feeding it the elapsed time with Length = 1 gives a value that goes 0 to 1 and back, the way a platform slides side to side.
Input
Type
Default
Description
Value
float
0.0
A number that keeps growing, usually the elapsed time.
Length
float
1.0
How high it climbs before turning back down.
Output
Type
Description
Result
float
The bounced value, between 0 and Length.
PhasesStartEvery FramePhysicsEnd
Random Float
Every Frame
Random FloatMath
Min0.0|Max1.0
Picks a random decimal number between Min and Max.
Input
Type
Default
Description
Min
float
0.0
The lowest possible value.
Max
float
1.0
The highest possible value.
Output
Type
Description
Result
float
The random number.
PhasesStartEvery FramePhysicsEnd
Random Int
Every Frame
Random IntMath
Min1|Max6
Picks a random whole number between Min and Max, both included, like rolling dice.
Input
Type
Default
Description
Min
int
1
The lowest possible value, included.
Max
int
6
The highest possible value, included.
Output
Type
Description
Result
int
The random number.
PhasesStartEvery FramePhysicsEnd
Set Random Seed
Start
Set Random SeedMath
0
Fixes the starting point of every random action that runs after it, so the same seed always gives the same rolls. With Seed = 12345 a roguelike lays out the exact same run every time, which is what a shareable run code or a daily challenge is built on.
Input
Type
Default
Description
Seed
int
0
The number that decides which sequence of random values comes out.
PhasesStartEvery FramePhysics
Smooth Step
Every Frame
Smooth StepMath
From0.0|To1.0|Value0.0
Turns a number into a 0 to 1 amount that starts slow, speeds up in the middle and eases out at the end. With From = 0 and To = 100, a value of 50 gives 0.5, anything below 0 gives 0 and anything above 100 gives 1. Use it instead of Map Range when a fade should not start and stop abruptly.
Input
Type
Default
Description
From
float
0.0
The value that gives 0. Anything below it also gives 0.
To
float
1.0
The value that gives 1. Anything above it also gives 1.
Value
float
0.0
The number to turn into an amount, such as a distance or a timer.
Output
Type
Description
Result
float
The eased amount, always between 0 and 1.
PhasesStartEvery FramePhysicsEnd
Wrap Number
Every Frame
Wrap NumberMath
Value0|Min0|Max10
Brings a number back into a range, so a value past the end comes out at Min again. It is what cycles a menu index from the last item back to the first.
Input
Type
Default
Description
Value
Variant
0
The number to bring back into the range.
Min
Variant
0
The start of the range, which the result can be.
Max
Variant
10
The end of the range, which the result never is. With a Min of 0, this is the item count.
Output
Type
Description
Result
Variant
The wrapped value, a whole number when every input is one.