0 votes

I'm wanting to make a Fighter game in the Godot engine. The players move left and right.
I want to change the scale of the Sprite, whenever It walks to the left.
The reason I'm using scale and not"flip_h" is because the Sprite node is a parent node for an Area2D and CollisionShape2D node.

Is there a way to change the Sprite's scale through code?( GDscript preferably)

in Engine by (15 points)

1 Answer

+2 votes
Best answer

You can change the scale property:

Examples:

node.scale = Vector2(1.5, 1.5)
node.scale.x = -1
node.scale.x *= -1

and so on.

by (20,677 points)
selected by

thank you very much! This is working

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.