As you can see in the video when my character moves he looks very jittery, almost as if he splits into 2 sprites and they move across the screen. I have snap transforms to pixel on in project settings and also have it on the the viewport settings in the scene. Anyone know how to fix this? I don't think it's my monitor because I can play other pixel art games like celeste just fine. thanks in advance.

It's hard to see in the video. Are you using delta time? How are you doing the movement, maybe post some code.

I had that same error and I think it's actually a mix between a visual effect and a bit of bad optimization.

Here is the code, ignore the area_entered signals.

extends CharacterBody2D
class_name Player

var speed : float = 7000
var acceleration_smoothing : float = 0.2
var gravity : float = 250
signal died
signal portal

func _ready():
	$IceArea.body_shape_entered.connect(_on_ice_entered)
	$PortalArea.body_shape_entered.connect(_on_portal_entered)

func _process(dt):
	var direction = Input.get_axis('left', 'right')
	velocity = lerp(velocity, Vector2(speed * direction * dt, velocity.y), acceleration_smoothing)
	
	if direction > 0:
		$AnimatedSprite2D.flip_h = false
	if direction < 0:
		$AnimatedSprite2D.flip_h = true
	
	if Input.is_action_just_pressed('flip'):
		gravity *= -1
		$AnimatedSprite2D.flip_v = !$AnimatedSprite2D.flip_v
		
	velocity.y += gravity * dt
	move_and_slide()

func _on_ice_entered(_body_rid, body, _body_shape_index, _local_shape_index):
	died.emit()

func _on_portal_entered(_body_rid, body, _body_shape_index, _local_shape_index):
	portal.emit()
  • xyz replied to this.

    Don't know why some of it registered as code and some didn't but thats the whole thing

    Anson558
    Enclose the code snippet between ~~~ tags
    That lerp thing... what happens if you remove it and just assign the velocity directly.

    it does the exact same effect. The lerp only really does anything the first 0.1 seconds of moving, and then the velocity reaches the max.

    • xyz replied to this.

      Anson558 Check if vsync is enabled in your project settings.

      Could be just your monitor. The way LCD panels work (sample and hold) make movement look blurry, especially at 60Hz (well, technically the monitor is fine, it's the way your eyes perceive discontinuous motion, but that's a long topic to explain). Perhaps put a background on that game. Having a solid color in the back is the worst case scenario for ghosting.

      Uhm, shouldn't you use _physics_process(delta) instead of _process(delta)? I think for things like physics and movement the former is preferred, as it is called at a set interval, while the latter is dependent on your fps.

      process gives better results for movement than physics_process (especially on high refresh monitors) but either can work.

      But you're correct, that's the issue, I didn't notice. The OP should change that to physics_process. Also, the function move_and_slide takes delta time into account, so multiplying velocity by delta is applying it twice (possibly the real issue).

      thanks! the jitter is fixed now. Didn't realize that dt already was applied to move_and_slide. I was so confused why I had to put the movement speed so high.