Show and hide a sprite

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

First of all sorry for the lame question and for the bad english.
I do not have any experience in python nor gdscript.

So, i’m making a 2D game and the player needs to get a key to open a door which leads to the next level.
When the player gets the key WHAT can I do to display the key icon when he acquires it? And on the next level I want the key icon to be hidden in the HUD until he gets another one.

I saw some tutorials but I’m having a hard time to adapt something usefull.

Thanks people :slight_smile:

:bust_in_silhouette: Reply From: quizzcode

$Sprite_name.show() ?
Youtube has some REALLY good tutorials for early stage game dev !
You should check out GDQUEST

yeah i usally watch some of them videos and some other tuturials like HeartBeast and Godot Recepies. Really great content :wink:

Thank you very much, i will try to implement the line to make the thing happen :wink:

benzfil | 2020-06-03 19:17

the godot doc was weird at first for me.
But it helps. Keep it open on your browser when you code.
You can hide(), show(), position with a Vector2() etc…

quizzcode | 2020-06-03 19:18