====== GDScript-Funktionen ====== ====== Methoden ====== | Color | Color8 ( int r8, int g8, int b8, int a8=255 ) | | | Color | ColorN ( String name, float alpha=1.0 ) | | | void | assert ( bool condition ) | | | Variant | bytes2var ( PoolByteArray bytes, bool allow_objects=false ) | | | String | char ( int ascii ) | | | Variant | convert ( Variant what, int type ) | | | float | dectime ( float value, float amount, float step ) | | | Object | dict2inst ( Dictionary dict ) | | | FuncRef | funcref ( Object instance, String funcname ) | | | Array | get_stack ( ) | | | int | hash ( Variant var ) | | | Dictionary | inst2dict ( Object inst ) | | | Object | instance_from_id ( int instance_id ) | | | bool | is_inf ( float s ) | | | bool | is_instance_valid ( Object instance ) | | | bool | is_nan ( float s ) | | | int | len ( Variant var ) | | | Resource | load ( String path ) | | | Variant | parse_json ( String json ) | | | Resource | preload ( String path ) | | | float | range_lerp ( float value, float istart, float istop, float ostart, float ostop ) | | | float | smoothstep ( float from, float to, float weight ) | | | float | stepify ( float s, float step ) | | | String | str ( … ) vararg | | | Variant | str2var ( String string ) | | | String | to_json ( Variant var ) | | | bool | type_exists ( String type ) | | | int | typeof ( Variant what ) | | | String | validate_json ( String json ) | | | PoolByteArray | var2bytes ( Variant var, bool full_objects=false ) | | | String | var2str ( Variant var ) | | | WeakRef | weakref ( Object obj ) | | | GDScriptFunctionState | yield ( Object object=null, String signal=”” ) | | Die Folgenden Funktionen sind in den jeweiligen Artikeln genauer erörtert: ===== Ausgabe ===== [[godot:syntax:print|Ausgabe]]\\ => Ausgabefenster | void | print ( … ) vararg | | | void | print_debug ( … ) vararg | | | void | print_stack ( ) | | | void | printerr ( … ) vararg | | | void | printraw ( … ) vararg | | | void | prints ( … ) vararg | | | void | printt ( … ) vararg | | => Debugger => Fehler | void | push_error ( String message ) | Fehlermeldung | | void | push_warning ( String message ) | Warnung | ===== Mathefunktionen ===== [[godot:syntax:mathe|Mathefunktionen]]\\ => Runden | float | round ( float s ) | rundet bei über 0.5 auf und unter 0.5 ab | | float | floor ( float s ) | rundet ab auf die nächstkleinere Ganzzahl | | float | ceil ( float s ) | rundet auf die nächstgrößere Ganzzahl | => Vorzeichen | float | abs ( float s ) | gibt den Absolutwert (ohne Vorzeichen) | | float | sign ( float s ) | -1 bei Zahl unter 0; 0 bei 0; 1 bei Zahl über Null | => Zufallszahlen | void | randomize ( ) | initialisiert die Zufallszahl | | float | randf ( ) | Zufallszahl zwischen Null und 1 | | int | randi ( )%100 | liefert Zufallszahl zwischen 0 und 99 | | float | rand_range ( float from, float to ) | | | Array | rand_seed ( int seed ) | | | void | seed ( int seed ) | initialisiert die Zufallszahl mit festen Wert | => Begrenzen | float | clamp ( float value, float min, float max ) hält den Wert zwischen min und max | | float | max ( float a, float b ) | liefert den größeren der beiden Werte | | float | min ( float a, float b ) | liefert den kleineren der beiden Werte | | float | wrapf ( float value, float min, float max ) | zählt die Fließkommazahl innerhalb von min und max weiter | | int | wrapi ( int value, int min, int max ) | zählt die Ganzzahl innerhalb von min und max weiter | => Potenzen | float | pow ( float x, float y ) | x hoch y | | float | sqrt ( float s ) | Quadratwurzel von s | | int | nearest_po2 ( int value ) | gibt die nächstgrößere Potenz von 2 für den Ganzzahlwert zurück | => Lineare interpolation | Variant | lerp ( Variant from, Variant to, float weight ) | | | float | inverse_lerp ( float from, float to, float weight ) | | => Range | Array | range ( … ) vararg | | => Rest | float | log ( float s ) | | | float | ease ( float s, float curve ) | | | float | exp ( float s ) | | ^ ^ ^ ^ | float | fmod ( float x, float y ) | rest von x/y | | float | fposmod ( float x, float y ) | | ^ ^ ^ ^ | float | decimals ( float step ) | liefert die Position der ersten Ziffer hinter dem Komma, welche nicht Null ist | ^ ^ ^ ^ | float | linear2db ( float nrg ) | konvertiert von linearer Energie in Dezibel (Audio). | | float | db2linear ( float db ) | | ===== Winkelfunktionen ===== [[godot:syntax:winkelfunktionnen|Winkelfunktionen]]\\ => Bogenmaß <=> Grad | float | deg2rad ( float deg ) | | | float | rad2deg ( float rad ) | | | float | sin ( float s ) | | | float | cos ( float s ) | | | float | tan ( float s ) | | | float | asin ( float s ) | | | float | acos ( float s ) | | | float | atan ( float s ) | | | float | sinh ( float s ) | | | float | cosh ( float s ) | | | float | tanh ( float s ) | | => Polardinatensystem <=> kartesische Koordinatensystem | Vector2 | polar2cartesian ( float r, float th ) | Konvertiert einen im Polarkoordinatensystem ausgedrückten 2D-Punkt (einen Abstand vom Ursprung r und einen Winkel th) in das kartesische Koordinatensystem (x- und y-Achse). | | Vector2 | cartesian2polar ( float x, float y ) | Konvertiert einen im kartesischen Koordinatensystem (x- und y-Achse) ausgedrückten 2D-Punkt in das Polarkoordinatensystem (Radius und Winkel). |