2d show and hide code problem

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

so I was following a tutorial and they got to the part where you can code something to show and hide (basically if your mouse is hovering over it it will show it but if it is not it will hide it) and at one point you have to write the same to code twice

" func _on_POS_mouse_entered(): "

and the person who originally coded that tutorial somehow uses that same code twice

( ps here’s the tutorial https://www.youtube.com/watch?v=5mJZvns8dew )

and by the way, I’m am just learning to code in GDscript.

I’m not sure what the problem or question is…

jgodfrey | 2020-05-20 17:26

the question is basically this

how do I write the same code twice without Godot not working

mnzz123 | 2020-05-20 17:31

Can you either 1) post the code you’re concerned about (properly formatted) or 2) link to a particular time stamp in the video where you think the issue is?

jgodfrey | 2020-05-20 17:34

the part I’m confused about is in the video tutorial (again https://www.youtube.com/watch?v=5mJZvns8dew)

is at 6:06 - 6:56

mnzz123 | 2020-05-20 17:39

:bust_in_silhouette: Reply From: jgodfrey

After a quick scan of the video, I see an on_POS_mouse_entered() function and an on_POS_mouse_exited() function. Is that what you’re referring to? Notice those are 2 different functions connected to 2 different Godot signals as follows:

func _on_POS_mouse_entered():

func _on_POS_mouse_exited():

What’s the confusion here?