0 votes

I have a TextureButton "buy" that signals to a script and a Label "quantity":
Is it possible for the user to click and hold the mouse button on the TextureButton, and while holding down the Label does a label = label + 1?

Here's what I have so far:

var temp_quantity = 0

func _on_buy_pressed():
 temp_quantity = temp_quantity + 1

I want the label_quantity to keep increasing in number the longer the user has the texturebutton clicked/pressed. Is it possible to do this?


in Engine by (61 points)

1 Answer

0 votes

For tasks like this Godot has a SpinBox node. It allows increasing as well as decreasing. It emits a signal when value changes.

It also has "Custom Icons" property for its buttons. Didn't use that but it looks like you can add your textures there.

You may need to resize it after adding to scene to see the buttons.

by (2,274 points)
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.