#Trying Digging on Mobile but bugs me out

1 messages · Page 1 of 1 (latest)

upbeat fossil
#

Im currently 3 months on godot from zero to what i am right now.

The issue is when im pressing on UI it disables my digging.

First Scene is Dig first then press ui which is what i want.

Second is press on ui then dig which disable my dig idk what to do im clueless

#

func handle_dig() -> void:
if dig_timer.is_stopped():
if is_mobile:
handle_mobile_dig()
print("Mobile")
else:
handle_pc_dig()
print("Pc")

func handle_pc_dig() -> void:
var is_touching_ui = is_pressed_on_ui(get_global_mouse_position())
var is_holding_block = Input.is_action_pressed("LMB") # PC Holding

if is_holding_block and (not is_touching_ui or is_point_in_dig_range(get_global_mouse_position())):
    handle_dig_at_position(get_global_mouse_position())
    dig_timer.start()

func handle_mobile_dig() -> void:
for event in get_tree().get_nodes_in_group("ui_controls"):
if event is Control and event.get_global_rect().has_point(get_global_mouse_position()):
return

if Input.is_action_pressed("LMB"):  
    var touch_pos = get_global_mouse_position()
    if is_point_in_dig_range(touch_pos):