godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.81k stars 3.09k forks source link

Squash the creep demo Doc GDscript snippet seems outdated #9498

Closed DaBaptisteFraboul closed 3 months ago

DaBaptisteFraboul commented 3 months ago

Your Godot version: I am using Godot_v4.2.2-stable_win64_console.exe.

Issue description: ✨Hello!✨

I am following the tutorial Squash the Creeps on the Godot 🤖 Documentation to learn the engine.

In the section Jumping and squashing monster / Squashing Monster this example code is shown :

func _physics_process(delta):
    #...

    # Iterate through all collisions that occurred this frame
    for index in range(get_slide_collision_count()):
        # We get one of the collisions with the player
        var collision = get_slide_collision(index)

        # If the collision is with ground
        if collision.get_collider() == null:
            continue

The condition if collision.get_collider() == null: seems to never occur. This confused me therefore I checked the completed project on Github and this condition is missing from the final code (see here)

I suppose the documentation is not up-to-date on this part.

It is my very first ticket on Godot ! 🎉🎫🎉

URL to the documentation page (if already existing): https://docs.godotengine.org/en/stable/getting_started/first_3d_game/06.jump_and_squash.html

DaBaptisteFraboul commented 3 months ago

My bad! I realized why this code was necessary after playing with the code.