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():
in Engine by (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.
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.