Godot Version: 4
Question
I have a Ship
which has this child:
$ShipBody (Area2D)
$ShipBody
in turn has 2 children:
$Sprite2D
and $CollisionPolygon2D
The ship won’t be removed until 2 seconds after current_health <= 0
…
During those 2 seconds, the ship should no longer monitor collisions .
But, in each of these ways that I’ve tried, the $ShipBody/Sprite2D
(or perhaps the whole ShipBody
node) becomes invisible.
This is quite unexpected.
I’ve worked around this by putting the collisionpolygon into it’s own Area2D and make the Ship a Node2D instead. But I still think it should work the other way since collisions and visibility should be independent. So…
Why does it happen?
I tried this:
func take_damage():
if current_health <= 0:
$ShipBody.monitoring = false
tween.tween_property($ShipBody, "modulate", Color(4, 2, 1), 2)
I also tried this:
$ShipBody/CollisionPolygon2D.set_disabled(true)
And this:
$ShipBody/CollisionPolygon2D.set_deferred("disabled", true)