Sprite isn't stretched

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Suikurx

I’m having this problem where my sprite is scaled incorrectly. I am using a sprite node, and the problem occurred when I added a script. How do I fix this?

extends KinematicBody2D

var velocity = Vector2.ZERO
export (int) var speed = 1200
export (int) var jump_speed = -1800
export (int) var gravity = 4000
export (float, 0, 1.0) var friction = 0.1
export (float, 0, 1.0) var acceleration = 0.25


var facing_right = true


## Player Movements
func get_input():
velocity.x = 0
if Input.is_action_pressed("ui_right"):
	velocity.x += speed
	facing_right = true
	$Sprite/AnimationPlayer.play("Running")
if Input.is_action_pressed("ui_left"):
	velocity.x -= speed
	facing_right = false
	$Sprite/AnimationPlayer.play("Running")

 if facing_right == true:
	$Sprite.scale.x = 1
else:
	$Sprite.scale.x = -1

func _physics_process(delta):
get_input()
velocity.y += gravity * delta
velocity = move_and_slide(velocity, Vector2.UP)
if Input.is_action_just_pressed("ui_up"):
	if is_on_floor():
  		velocity.y = jump_speed

My Problem

Could you provide some information? What’s the settings of the node you’re using? Any other nodes involved? Btw, the image isn’t showing up.

Ertain | 2021-08-22 00:35

:bust_in_silhouette: Reply From: MisterMano

As @Ertain mentioned above, your pic link isn’t working (it’s a local link of your machine). In any case, be sure to check the animation’s keyframes, see if there’s any that changes the scale.

Also, since facing_right is already a boolean type, you don’t need to use if facing_right == true,use this instead: if facing_right