I tried using the code below but it doesnt seem to work as intended. Im trying to make a really bouncy ball projectile that will change shape depending on its speed. Any advice would really help!

func integrateforces(state):
var counter = [false,false,false,false]
var veclocity = abs(linear_velocity.y)
print(veclocity)

``````if veclocity >= 400:
if counter[0] == false:
\$Skin.scale.y += 0.025
counter[0] = true
if veclocity >= 600:
if counter[1] == false:
\$Skin.scale.y += 0.025
counter[1] = true
if veclocity >= 800:
if counter[2] == false:
\$Skin.scale.y += 0.025
counter[2] = true
if veclocity >= 1000:
if counter[3] == false:
\$Skin.scale.y += 0.025
counter[3] = true

if veclocity <= 1000:
if counter[0] == true:
\$Skin.scale.y -= 0.025
counter[0] = false
if veclocity <= 800:
if counter[1] == true:
\$Skin.scale.y -= 0.025
counter[1] = false
if veclocity <= 600:
if counter[2] == true:
\$Skin.scale.y -= 0.025
counter[2] = false
if veclocity <= 400:
if counter[3] == true:
\$Skin.scale.y -= 0.025
counter[3] = false
``````
Godot version Godot Version 3.2
in Engine

+1 vote

YouÂ´re thinking too complex.
Try something like this:

``````\$Skin.scale.y = 1 + abs(velocity.y/400)
``````
by (50 points)
selected by

This worked, thank you so much! lol I really did complicate it

+1 vote

Animation is a lot easier.
You will just create the sprites variations and change them as you fit.

by (232 points)