0 votes

So, I've been studying the GDQuest tutorial on How to Detect Gestures (see here)
to make a 'click and hold' event controller. However, when I try to use the positions I get back to set my transform, it's always about half the screen offset to the right and down from where I click. Is there something about screen positions that I'm not getting?

extends Node2D

signal pressed(pos)
signal press_cancel(pos)
signal press_complete(pos)

onready var hold = $PressHold
var hold_pos = Vector2()

func _input(event):
    if not event is InputEventScreenTouch:
    if event.pressed:
    elif hold.is_stopped() and hold_pos !=  Vector2():

func _start_press(event):
    hold_pos = event.position #Only not. !!!!!!!!!!!FIXME
    global_position = hold_pos

func _complete_press():
    emit_signal("press_complete", hold_pos)
    hold_pos = Vector2()

func _cancel_press():
    emit_signal("press_cancel", hold_pos)
    hold_pos = Vector2()

func _on_PressHold_timeout():
asked Jun 6, 2019 in Engine by scrapcupcake (12 points)

Please log in or register to answer this question.

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.