Skip to content
Lukas Sägesser edited this page Jun 22, 2015 · 14 revisions

@GDScript

####Category: Core

Brief Description

Built-in GDScript functions.

Member Functions

Numeric Constants

  • PI = 3.141593 - Constant that represents how many times the diameter of a circumference fits around it's perimeter.

Description

This contains the list of built-in gdscript functions. Mostly math functions and other utilities. Everything else is expanded by objects.

Member Function Description

Standard sine function.

Standard cosine function.

Standard tangent function.

Hyperbolic sine.

Hyperbolic cosine.

Hyperbolic tangent.

Arc-sine.

Arc-cosine.

Arc-tangent.

Arc-tangent that takes a 2D vector as argument, retuns the full -pi to +pi range.

Square root.

Module (remainder of x/y).

Module (remainder of x/y) that wraps equally in positive and negative.

Floor (rounds down to nearest integer).

Ceiling (rounds up to nearest integer).

Round to nearest integer.

Remove sign (works for integer and float).

Return sign (-1 or +1).

Power function, x elevate to y.

Natural logarithm.

Exponential logarithm.

Return true if the float is not a number.

Return true if the float is infinite.

Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.

Return the amount of decimals in the floating point value.

Snap float value to a given step.

Linear interpolates between two values by a normalized value.

Decreases time by a specified amount.

  • Nil randomize ( )

Reset the seed of the random number generator with a new, different one.

  • int randi ( )

Random 32 bits value (integer). To obtain a value from 0 to N, you can use remainder, like (for random from 0 to 19): randi() % 20.

Random value (0 to 1 float).

Random range, any floating point value between 'from' and 'to'

Random from seed, pass a seed and an array with both number and new seed is returned.

Convert from degrees to radians.

Convert from radias to degrees.

Convert from linear energy to decibels (audio).

Convert from decibels to linear energy (audio).

Return the maximum of two values.

Return the minimum of two values.

Clamp both values to a range.

Return the nearest larger power of 2 for an integer.

Return a weak reference to an object.

Returns a reference to the specified function

Convert from a type to another in the best way possible. The "type" parameter uses the enum TYPE_* in Global Scope.

  • String str ( var what, var ... )

Convert one or more arguments to strings in the best way possible.

  • String str ( var what, var ... )

Convert one or more arguments to strings in the best way possible.

  • Nil print ( var what, var ... )

Print one or more arguments to strings in the best way possible to a console line.

  • Nil printt ( var what, var ... )

Print one or more arguments to the console with a tab between each argument.

  • Nil printerr ( var what, var ... )

Print one or more arguments to strings in the best way possible to standard error line.

  • Nil printraw ( var what, var ... )

Print one or more arguments to strings in the best way possible to console. No newline is added at the end.

Converts the value of a variable to a String.

Converts the value of a String to a variable.

  • Array range ( var ... )

Return an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial,final-1,increment).

Load a resource from the filesystem, pass a valid path as argument.

Convert a script class instance to a dictionary (useful for serializing).

Convert a previously converted instances to dictionary back into an instance. Useful for deserializing.

  • int hash ( var var:var )

Hashes the variable passed and returns an integer.

  • Nil print_stack ( )

Print a stack track at code location, only works when running with debugger turned on.

Clone this wiki locally