Options
All
• Public
• Public/Protected
• All

# Namespace common

## Functions

• acosh(arg: number): number
• Hyperbolic arc-cosine

Value.

#### Returns number

The hyperbolic arc-cosine for the value.

• angleBetweenPositions(x1: number, y1: number, x2: number, y2: number): number
• Returns the angle, in degrees, between two positions.

#### Parameters

• ##### x1: number

First point X position.

• ##### y1: number

First point Y position.

• ##### x2: number

Second point X position.

• ##### y2: number

Second point Y position.

#### Returns number

The angle between the positions, in degrees.

• angleDifference(angle1: number, angle2: number): number
• Returns the difference between two angles, in degrees.

#### Parameters

• ##### angle1: number

First angle, in degrees.

• ##### angle2: number

Second angle, in degrees.

#### Returns number

Return the difference of the angles, in degrees.

• asinh(arg: number): number
• Hyperbolic arcsine

Value.

#### Returns number

The hyperbolic arcsine for the value.

• atanh(arg: number): number
• Hyperbolic arctangent

Value.

#### Returns number

The hyperbolic arctangent for the value.

• cbrt(x: number): number
• ceilTo(value: number, decimalPlace: number): number
• Rounds up a number to the Nth decimal place

#### Returns number

the rounded value

• clamp(x: number, min: number, max: number): number
• Limit a value to a range.

#### Parameters

Value.

• ##### min: number

The minimum value.

• ##### max: number

The maximum value.

#### Returns number

The new value.

• cosh(arg: number): number
• Hyperbolic cosine

Value.

#### Returns number

The hyperbolic cosine for the value.

• cot(arg: number): number
• csc(arg: number): number
• distanceBetweenPositions(x1: number, y1: number, x2: number, y2: number): number
• Returns the distance, in pixels, between two positions.

#### Parameters

• ##### x1: number

First point X position.

• ##### y1: number

First point Y position.

• ##### x2: number

Second point X position.

• ##### y2: number

Second point Y position.

#### Returns number

The distance between the positions, in pixels.

• exponentialInterpolation(start: number, end: number, progress: number): number
• Return an exponential interpolation between start and end.

For instance, exponentialInterpolation(2, 8, 0.5) is 4.

#### Parameters

• ##### start: number

Start value.

End value.

• ##### progress: number

The interpolation value between 0 and 1.

#### Returns number

The interpolated value.

• floorTo(value: number, decimalPlace: number): number
• Rounds down a number to the Nth decimal place

#### Returns number

the rounded value

• getVariableBoolean(variable: Variable, compareWith: boolean): boolean
• getVariableChildCount(variable: Variable): number
• getVariableNumber(variable: Variable): number
• getVariableString(variable: Variable): string
• getXFromAngleAndDistance(angle: number, distance: number): number
• Compute the X position when given an angle and distance relative to the origin (0;0). This is also known as getting the cartesian coordinates of a 2D vector, using its polar coordinates.

#### Parameters

• ##### angle: number

The angle, in degrees.

• ##### distance: number

The distance from the object, in pixels.

#### Returns number

• getYFromAngleAndDistance(angle: number, distance: number): number
• Compute the Y position when given an angle and distance relative to the origin (0;0). This is also known as getting the cartesian coordinates of a 2D vector, using its polar coordinates.

#### Parameters

• ##### angle: number

The angle, in degrees.

• ##### distance: number

The distance from the object, in pixels.

• deprecated

#### Returns boolean

• isMobile(): boolean
• Check if the game runs on a mobile device (iPhone, iPad, Android). Note that the distinction between what is a mobile device and what is not is becoming blurry. If you use this for mobile controls, prefer to check if the device has touchscreen support.

#### Returns boolean

• lerp(a: number, b: number, x: number): number
• Return a linear interpolation between a and b.

For instance, lerp(2, 8, 0.5) is 5.

#### Parameters

• ##### a: number

Start value.

End value.

• ##### x: number

The interpolation value between 0 and 1.

#### Returns number

The interpolated value, now between a and b.

• lerpAngle(angle1: number, angle2: number, x: number): number
• Linearly interpolates between two angles (in degrees) by taking the shortest direction around the circle.

#### Parameters

• ##### angle1: number

Starting angle, in degrees.

• ##### angle2: number

Destination angle, in degrees.

• ##### x: number

The interpolation value between 0 and 1.

#### Returns number

Return the interpolated angle, in degrees.

• log10(arg: number): number
• Base-10 logarithm

Value.

#### Returns number

The base-10 logarithm for the value.

• log2(arg: number): number
• Base-2 logarithm

Value.

#### Returns number

The base-2 logarithm for the value.

• logicalNegation(bool: boolean): boolean
• Negate the boolean.

#### Parameters

• ##### bool: boolean

The boolean to negate.

#### Returns boolean

The negated value.

• mod(x: number, y: number): number
• Modulo operation (the remainder after dividing one number by another)

#### Parameters

• ##### x: number

Dividend value.

• ##### y: number

Divisor value.

#### Returns number

Return the remainder for the values.

• normalize(val: number, min: number, max: number): number
• Normalize a value between min and max to a value between 0 and 1.

#### Parameters

• ##### val: number

The value to normalize

• ##### min: number

The minimum

• ##### max: number

The maximum

#### Returns number

The normalized value between 0 and 1

• nthroot(x: number, n: number): number
• N-th root

#### Parameters

• ##### x: number

Base value.

• ##### n: number

Exponent value.

#### Returns number

Return the n-th root for the value.

• pi(): number
• resolveAsyncEventsFunction(eventsFunctionContext: EventsFunctionContext): void
• roundTo(value: number, decimalPlace: number): number
• Rounds a number to the Nth decimal place

#### Returns number

the rounded value

• sceneVariableExists(runtimeScene: RuntimeScene, variableName: string): boolean
• deprecated

#### Returns boolean

• sec(arg: number): number
• setVariableBoolean(variable: Variable, newValue: boolean): void
• sign(arg: number): number
• Returns the sign of the number. This checks if the value is positive, negative or zero.

Value.

#### Returns number

Return the sign for the value (1, -1 or 0).

• sinh(arg: number): number
• tanh(arg: number): number
• Hyperbolic tangent

Value.

#### Returns number

The hyperbolic tangent for the value.

• toNumber(str: string): number
• Convert a string to a number.

#### Parameters

• ##### str: string

String to convert.

#### Returns number

The parsed number, or NaN if invalid.

• toString(num: number): string
• Convert a number to a string.

#### Parameters

• ##### num: number

Value to convert to a string.

#### Returns string

The value as a string.

• toggleVariableBoolean(variable: Variable): void
• trunc(x: number): number
• Truncate a number.

Value.

#### Returns number

Return the value with all decimal places dropped.

• valuePush(array: Variable, value: string | number | boolean): void
• variableChildExists(variable: Variable, childName: string): boolean
• variableClearChildren(variable: Variable): void
• variableRemoveAt(array: Variable, index: number): void
• variableRemoveChild(variable: Variable, childName: string): void

Generated using TypeDoc