0 votes

What I want to do is use the speed of my screen drag/scrolling to keep scolling according to how fast I swiped/scrolled even when I'm not touching the sceen anymore.
This is the code I'm using but it doesnt show the desired effect:

func _process(_delta):
    $ScrollContainer/HBoxContainer/Control.position.x = lerp( 
    $ScrollContainer/HBoxContainer/Control.position.x, -$HScrollBar.value,0.07)

" if i touch the screen areaEnt will be true"

 func _on_TouchScreenButton_pressed():
    areaEnt = true

 func _on_TouchScreenButton_released():
   areaEnt = false

 func _input(event):
    if areaEnt:
        if event is InputEventScreenTouch:
            if event.is_pressed():
        touchpos = event.position.x
        deltaX = (touchpos + $HScrollBar.value)
    elif event is InputEventScreenDrag:
        touchpos = event.position.x
        new_deltaX = (touchpos - deltaX)
        $HScrollBar.value = -new_deltaX 

I know I get the speed with event.speed but I don't know how to use it correctly.Any ideas?

in Engine by (16 points)
reshown by

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 Frequently asked questions and 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 [email protected] with your username.