0 votes


I have a simple projectile that is an Area2d with a sprite in it. I am moving towards a set position. I want to scale down based on how far along I am - 50% of the way there should be 50% smaller etc.

node.scale(Vector2(0.5, 0.5)) seems to be additive because my node (projectile) disappears quickly. What am I doing wrong here?

var percentleft = targetpoint.distance_to(self.get_global_pos())/initialflightdistance
self.scale(Vector2(percentleft ,percentleft))

I am thinking that I need some other approach, like a global scale. This call seems to be "additive" to the existing scale on the object? So I might scale to 90% then 90% of that 90% then 90% of that and so on.



in Engine by (41 points)

2 Answers

0 votes

This seems like the perfect opportunity to use a Tween:

Set the Tween to interpolate the transform/scale property.

by (20,481 points)

I will look into that. Thank you.

0 votes

You want to use set_scale() if you want to specifically set it, scale() applies the value against the current scaling.

by (5,206 points)

So "scale" scales the value you already have, and set_scale is absolute then? That makes sense based on what I am seeing.

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.