0 votes

Hello all, I'm trying to create a bounce effect on my sprite, but thats what happens:
enter image description here

And here its my code:
enter image description here

The part where I want the effect its "e o retorno do herĂ³i" (the last one).

in Engine by (171 points)

1 Answer

+1 vote

How large is the difference between the initial value (get_position()) and the final value (alvo) of the tween? If it is too small you may not notice the effect at all. Same for the duration: given how short it is (0.2) it might happen to fast to notice.

Alternatively you can create the bounce-effect yourself by chaining the interpolations using the (optional) delay-parameter of interpolate_property:

var initial = get_position()
move_frase.interpolate_property(self, "position:y", get_position.y, alvo.y, .1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
move_frase.interpolate_property(self, "position:y", alvo.y, alvo.y-100, .1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT, 0.1)
by (10,261 points)

I changed the speed to 1 second and thats what happened:
enter image description here

I tried to change the distance between the initial and final points, but the result still the same. Idk what I'm doing wrong here haha

That's strange. Can you upload an example project?

Here is: Test example

Your upload contains the already compiled project. Simply zip the directory containing your project as is. Do not export the project (using Project > Export) to a zip-file.

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.