Touch Screen issues

Godot Version

Version 3.5

Question

How do i stop the function lighten_green_skins() from calling. I only want the function to call if i touch somewhere else on the screen, but not if i touch the button.

func _unhandled_input(event: InputEvent) -> void:
	
	if event is InputEventScreenTouch:
		if $Green_Skin.scale == Vector2(0.6,0.6):
			if not Green_Skin_Button.is_pressed():
					
					lighten_green_skins()
func _unhandled_input(event: InputEvent) -> void:
	
	if event is InputEventScreenTouch and event.is_pressed():
		if $Green_Skin.scale == Vector2(0.6,0.6):
			if not Green_Skin_Button.is_pressed():
					
					lighten_green_skins()

Thx for your solution. It works. Could you explain why it works lol

you weren’t just detecting if the input event is pressed or not, so it can be any unhandled input accessing the lighten green skins method

hence why added event.is_pressed() to check if actually you clicked the screen or not then continue checking the following code block

Ok thanks for that

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.