Get node but use more node at a time

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dimkauzh

I need to tag more nodes in a time but it dont allow me that. But i don’t want my code like this:

func off_off_ladder_checker():
$Off_Ladder_Block/CollisionShape2D.set_deferred("disabled", false)
$Off_Ladder_Block/CollisionShape2D2.set_deferred("disabled", false)
$Off_Ladder_Block/CollisionShape2D3.set_deferred("disabled", false)
$Off_Ladder_Block/CollisionShape2D4.set_deferred("disabled", false)
$Off_Ladder_Block/CollisionShape2D5.set_deferred("disabled", false)

I want it a little bit shorter without repeats.
Can someone help please?

:bust_in_silhouette: Reply From: kidscancode

You could do

for node in $Off_Ladder_Block.get_children():
    node.set_deferred("disabled", false)

As a a general rule, any time you’re repeating yourself a bunch of times, a loop is probably the solution.