0 votes

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 onPOSmouseentered(): "

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.


in Engine by (12 points)

I'm not sure what the problem or question is...

the question is basically this

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

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?

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

1 Answer

+1 vote

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():
    $mouse_over.show()

func _on_POS_mouse_exited():
    $mouse_over.hide()

What's the confusion here?

by (12,282 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.