Programing a frog tongue

Godot Version 4.7

QuestionHi! I`m trying to make a tongue that extends to te mouse, so first I did the tip of the tongue follow the mouse and than this script in the rest of it

@export var ponta: Node2D

var pos_ponta: Vector2

var dist

func _process(delta: float) -> void:

    pos_ponta = ponta.global_position

    dist = global_position.distance_to(pos_ponta)

    scale.x = dist

where it worked fine, but the sprite got a little jagged (I`m using pixel art), so I scaled the sprites (when exporting them from aseprite, not on godot) and increased the resolution of the window, but the body of the tongue just stretched to infinity and was wayyyy over the tip.

Anyone knows why is this happening and why is it scaling more than just the distance between the starter point and the tip like it was on lower res?

scale is a multiplier based on the size of the sprite, if your sprite is two pixels then a scale of two will result in four pixels for your tongue. If you divide the scale by your sprite’s width it should end up with the correct size in pixels.

ohhh that makes sense! Ty!

Just tried and it worked dividing by half of the width of the image, because it was centered at the side of the sprite and not the middle!