summaryrefslogtreecommitdiff
path: root/doc/classes/KinematicBody2D.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/KinematicBody2D.xml')
-rw-r--r--doc/classes/KinematicBody2D.xml19
1 files changed, 14 insertions, 5 deletions
diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml
index 17c4b85346..476b64a336 100644
--- a/doc/classes/KinematicBody2D.xml
+++ b/doc/classes/KinematicBody2D.xml
@@ -37,11 +37,20 @@
<description>
Returns a [KinematicCollision2D], which contains information about a collision that occurred during the last call to [method move_and_slide] or [method move_and_slide_with_snap]. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count] - 1).
[b]Example usage:[/b]
- [codeblock]
+ [codeblocks]
+ [gdscript]
for i in get_slide_count():
var collision = get_slide_collision(i)
print("Collided with: ", collision.collider.name)
- [/codeblock]
+ [/gdscript]
+ [csharp]
+ for (int i = 0; i &lt; GetSlideCount(); i++)
+ {
+ KinematicCollision2D collision = GetSlideCollision(i);
+ GD.Print("Collided with: ", (collision.Collider as Node).Name);
+ }
+ [/csharp]
+ [/codeblocks]
</description>
</method>
<method name="get_slide_count" qualifiers="const">
@@ -55,21 +64,21 @@
<return type="bool">
</return>
<description>
- Returns [code]true[/code] if the body is on the ceiling. Only updates when calling [method move_and_slide] or [method move_and_slide_with_snap].
+ Returns [code]true[/code] if the body collided with the ceiling on the last call of [method move_and_slide] or [method move_and_slide_with_snap]. Otherwise, returns [code]false[/code].
</description>
</method>
<method name="is_on_floor" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns [code]true[/code] if the body is on the floor. Only updates when calling [method move_and_slide] or [method move_and_slide_with_snap].
+ Returns [code]true[/code] if the body collided with the floor on the last call of [method move_and_slide] or [method move_and_slide_with_snap]. Otherwise, returns [code]false[/code].
</description>
</method>
<method name="is_on_wall" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns [code]true[/code] if the body is on a wall. Only updates when calling [method move_and_slide] or [method move_and_slide_with_snap].
+ Returns [code]true[/code] if the body collided with a wall on the last call of [method move_and_slide] or [method move_and_slide_with_snap]. Otherwise, returns [code]false[/code].
</description>
</method>
<method name="move_and_collide">