Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | GeckoDev |
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 _integrate_forces(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