Skip to content

Improved disable logic#5

Open
GourabSN wants to merge 3 commits into
Mustache-Games:mainfrom
GourabSN:main
Open

Improved disable logic#5
GourabSN wants to merge 3 commits into
Mustache-Games:mainfrom
GourabSN:main

Conversation

@GourabSN

Copy link
Copy Markdown
Contributor

Improved func _input(event) to make the disable function work. Before this, disabling a button only disabled its texture but the button itself was clickable and it was taking input.

The changes:

func _input(event):
	if event is InputEventScreenTouch:
		if not event.pressed:
			if touch_index == event.index:
				release()
			return
			
		if disabled:
			return
			
		if is_in(event.position):
			if released:
				touch_index = event.index
				press()
			else:
				release()

Before:

 before

After:

after

GourabSN added 3 commits June 13, 2026 08:18
Added `if disabled` to make the disable function work. Before this, disabling a button only disabled its texture and the button was clickable.
```
func _input(event):
	if disabled:
		return
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant