Since the images are not shown here is my data.
Tree: cloture.tscn
cloture (Type: node2D)
|__ k1 (Type: KinematicBody2D)
****|__ brun (Type: CollisionShape2d)
********|___ b1 (Type: Sprite)
SCRIPT: in game.tscn
Here is my first statement:
var barreau1 = preload("res://scenes/cloture.tscn")
var barreau2 = preload("res://scenes/cloture.tscn")
Creation of the instances:
k1 = barreau1.instance()
brun1 = k1.get_node("k1/brun")
b1 = k1.get_node("k1/brun/b1")
k2 = barreau2.instance()
brun2 = k2.get_node("k2/brun")
When the user makes a mistake, I match the error number:
match compteur:
1:
$explosion.start()
brun1.set_deferred("disabled",true)
b1.visible = false
brun2.set_deferred("disabled",true)
b2.visible = false
2:
$explosion.start()
bleu3.set_deferred("disabled",true)
b3.visible = false
bleu4.set_deferred("disabled",true)
b4.visible = false
In this routine I want to disable the CollisionShape2d and hide th Sprite
I am not able to hide the Sprite and disable the CollisionShape2d
I tried setdefered, free, queuefree nothing works.
Michel