From 88a6d2fd6a18073b62cd5dfbe9d545cc492a86f2 Mon Sep 17 00:00:00 2001 From: Luiz Strobelt Date: Sat, 30 Sep 2023 19:00:45 -0300 Subject: [PATCH] Add C# Tips to 3d tutorial game --- getting_started/first_3d_game/06.jump_and_squash.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/getting_started/first_3d_game/06.jump_and_squash.rst b/getting_started/first_3d_game/06.jump_and_squash.rst index ae0e5f6e34e..fc506847962 100644 --- a/getting_started/first_3d_game/06.jump_and_squash.rst +++ b/getting_started/first_3d_game/06.jump_and_squash.rst @@ -269,6 +269,8 @@ With this code, if no collisions occurred on a given frame, the loop won't run. KinematicCollision3D collision = GetSlideCollision(index); // If the collision is with a mob. + // With C# we leverage typing and pattern-matching + // instead of checking for the group we created. if (collision.GetCollider() is Mob mob) { // We check that we are hitting it from above. @@ -344,6 +346,10 @@ destroy the mob. QueueFree(); } +.. note:: + + When using C#, Godot will create the appropriate events automatically for all Signals ending with `EventHandler`, see :ref:`C# Signals `. + We will use the signal to add points to the score in the next lesson. With that, you should be able to kill monsters by jumping on them. You can press