0 votes

I'm a total noob. it's like every time I try to script anything it won't work...

Example, how would I set the visibility on a sprite using button?

extends Panel

func _on_button_pressed():

func _ready():

So that won't do anything ...

And also what does the (self) mean? Thanks ...

in Engine by (22 points)
edited by

1 Answer

+1 vote
Best answer
extends Panel

func _on_button_pressed():

func _ready():

self means current instance, it is same with this in another languages.

by (9,778 points)
selected by

Wow.. so let me try to understand..
the last line 'connect' the pressed state of "button" with the function declared at second line. It connect the function to a trigger. Ok.

But what is " !getnode("Sprite").ishidden() " doing exactly ?
Is it a way to flip/flap visible and hidden according to current state of the "Sprite" ?

( Just starting with Godot, aka total noob as would say friendlyappretice )

Thanks for the reply @volzhs. And yep Graphitik it is to do as you've written

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 Frequently asked questions and 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 [email protected] with your username.