Godot Version
v4.3.stable.official [77dcf97d8]
Hi, I’m creating a top down pixelart game, I created a sprite for the character with the various movements and after creating the animation tree everything seemed to work with a fixed camera. As soon as I created a level and set Camera2D as the player’s child, strange artifacts appeared that distorted the player.
this is what the sprite should look like
Here is the sprite file
the player code:
extends CharacterBody2D
@export var speed = 100
@export var accel = 10
func _physics_process(_delta):
var direction: Vector2 = Input.get_vector("Left", "Right", "Up", "Down")
velocity.x = move_toward(velocity.x, speed * direction.x, accel)
velocity.y = move_toward(velocity.y, speed * direction.y, accel)
if velocity == Vector2.ZERO:
$AnimationTree.get("parameters/playback").travel("Idle")
else:
$AnimationTree.get("parameters/playback").travel("Walk")
$AnimationTree.set("parameters/Idle/blend_position", velocity)
$AnimationTree.set("parameters/Walk/blend_position", velocity)
move_and_slide()
func _process(_delta: float) -> void:
pass
I looked for various solutions here on the forum but I didn’t find anything that helped me, I would like to solve this problem before continuing with the game.