Stretching sprites in Godot

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By falafel
:warning: Old Version Published before Godot 3 was released.

I would like the ability to dynamically stretch a sprite for a certain amount along both the X and Y axes, by specific amounts or percentages. So for example, I might stretch a sprite’s width to 120% of its default width, but I would stretch its height to 200%. Then, in the next iteration of the game loop, I might stretch that particular sprite’s height only to 190%, or maybe 210%, depending on certain circumstances.

Is that possible currently in Godot?

:bust_in_silhouette: Reply From: bruteforce

IMO this is a simple scaling.

For example:

var sprite = get_node("path/to/sprite/node")
var scale = sprite.get_scale()
	
scale.x = scale.x*1.2
scale.y = scale.y*2
	
sprite.set_scale(scale)

Does this scaling work well with anti-aliasing present in the existing sprite?

falafel | 2017-10-03 18:13

I don’t know, try it :)!

bruteforce | 2017-10-03 18:18