summaryrefslogtreecommitdiff
path: root/doc/classes/@GDScript.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/@GDScript.xml')
-rw-r--r--doc/classes/@GDScript.xml27
1 files changed, 22 insertions, 5 deletions
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index 63b9ef13fd..b6de5dbf62 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -92,13 +92,13 @@
<argument index="0" name="condition" type="bool">
</argument>
<description>
- Assert that the [code]condition[/code] is [code]true[/code] . If the [code]condition[/code] is [code]false[/code] a fatal error is generated and the program is halted. Useful for debugging to make sure a value is always [code]true[/code].
+ Asserts that the [code]condition[/code] is [code]true[/code] . If the [code]condition[/code] is [code]false[/code], an error is generated and the program is halted until you resume it. Only executes in debug builds, or when running the game from the editor. Use it for debugging purposes, to make sure a statement is [code]true[/code] during development.
[codeblock]
- # Speed should always be between 0 and 20
+ # Imagine we always want speed to be between 0 and 20
speed = -10
- assert(speed &lt; 20) # Is true and program continues
- assert(speed &gt;= 0) # Is false and program stops
- assert(speed &gt;= 0 &amp;&amp; speed &lt; 20) # Or combined
+ assert(speed &lt; 20) # True, the program will continue
+ assert(speed &gt;= 0) # False, the program will stop
+ assert(speed &gt;= 0 &amp;&amp; speed &lt; 20) # You can also combine the two conditional statements in one check
[/codeblock]
</description>
</method>
@@ -640,6 +640,23 @@
[/codeblock]
</description>
</method>
+ <method name="move_toward">
+ <return type="float">
+ </return>
+ <argument index="0" name="from" type="float">
+ </argument>
+ <argument index="1" name="to" type="float">
+ </argument>
+ <argument index="2" name="delta" type="float">
+ </argument>
+ <description>
+ Moves [code]from[/code] toward [code]to[/code] by the [code]delta[/code] value.
+ Use a negative [code]delta[/code] value to move away.
+ [codeblock]
+ move_toward(10, 5, 4) # returns 6
+ [/codeblock]
+ </description>
+ </method>
<method name="nearest_po2">
<return type="int">
</return>