How to make sprite disappear by using if?

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

I wanted to write a script like
if sprite1 visible is true, sprite2 visible is false.
Is there any possible way to do so?

:bust_in_silhouette: Reply From: LeslieS

Assuming module level vars:

onready var sprite1 = $Sprite1
onready var sprite2 = $Sprite2

then in a function:

if sprite1.visible == true: 
    sprite2.visible = false

Or shortcut

sprite2.visible = sprite1.visible != true