This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Sorry for amateur question as I am a beginner in game development. I am not able to find a way to implement the animation based on touch. Basically more the user drags the touch , the more the rope should be pulled. I can create a animation player for end and starting points, but getting confused as to how to control its pulling length.
Please refer to this video , i am talking about the rope where the bird is placed. The concept i am trying to implement is similar to pulling a rubber band.

in Engine by (18 points)

1 Answer

+1 vote
Best answer

My initial thought would be to make the rubberband a seperate scene with a sprite, a tween and an anchor point (maybe a position2d?).
In its (the rubberbands) process function I would have written something like this piece of pseudo-code:

    get distance between finger input and anchor point
    get angle bewteen anchor point and input
    clamp the values to minimum and maximum values, so you dont get overexaggerated results
    tween the rubberband sprite the evaluated distance and angle

Just an idea, maybe someone knows a better or more elegant way. You can check the docs if there are functions to help make the calculations or you could calculate it by code with vector math. Here is a really good explanaiton on vector math, if you have not read it already:

by (143 points)
selected by
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.