Godot Version
4.3
Question
I’m in the process of learning Goodot, and I currently develop a Lunar Landing game.
My character (CharacterBody2D) has 3 sprites depending on its status : a still sprite when falling, a flame sprite when the engine is on, and an astronaut sprite, when the landing is successfull.
If the landing is not sucessfull, I want to start a particle system, and hide all the sprites. Here’s the code:
func has_landed() -> void:
if ( successfull_landing()):
$astronaut.visible = true
else:
$SpriteExplosion.emitting = true
$astronaut.visible = false
$still.visible = false
$flame.visible = false
landed = true
rotate(-rotation)
velocity = Vector2(0,0)
game_ended.emit()
It works… expect that the module is still visible, just has if the line $visible = false wasn’t there.
What could cause that?