#Relearning GDscript

13 messages · Page 1 of 1 (latest)

little kite
#

Hey just started to relearn Godot, trying to get the basics down and try to adapt to it.
Just doing it step by step so that way I can be able to understand it.
I work at a slower pace then most people so it takes me a while to understand it.
right now I'm just getting used to the feel of the engine and it's script.
right now I looked up on getting a sprite to be the mouse cursor in script and was able to find out how online.
working in 2D. Only starting small to progress little by little.
right now I am working on how make a clicker game, not using a tutorial at the moment just want to mess around and see what I can do.

I am currently trying to figure out out to make a sprit disappear when you click on it, I will take a picture of what I am currently dealing with, my code knowledge isn't he best.

pulsar ferry
#

nobody has 'the best code knowledge'
sprite can have a button with flat attribute activated

little kite
#

Thank you

glacial pond
#

Control nodes (for UI's) have a signal called "gui_input" that activates if you have your mouse over it. You then can make something like:

func _on_gui_input(event):
        # If left mouse pressed
    if event.is_action_released("LeftMouse"):
                # Delete Sprite
        %Sprite.queue_free()```
tropic zealot
#

@little kite $Sprite.visible = false could do it.

#

Just take that guys advice from above but switch it on and off instead of outright queuefreeing it

#

Or show() and hide()

little kite
#

Thank you both

pulsar ferry
#

@tropic zealot it was just an example

tropic zealot
pulsar ferry
#

yeah I don't usually see this in examples

glacial pond
#

Well, queue_free is the best option if you're not going to show it again, considering memory and performance. But yes, for something that shows and hides, show() and hide() it's better