I'm using a tween to try to get an object to follow the direct movements of the player. However an issue I've been having for a while is that the object will jitter whilst moving. Example: (usually it's a lot worse than this, I don't know why it's so mild here)

Here's the code:

extends KinematicBody2D

onready var move_tween = get_node("/root/Node2D/partymember/Tween")
onready var player = get_node("/root/Node2D/KinematicBody2D")
var velocity = Vector2()
func party_move(target):
	move_tween.interpolate_property(self, "position", velocity, target, 0)
func _process(_delta):
	move_tween.interpolate_callback(self, 0.45, "party_move", player.position)
func _ready():
	position = player.position
	move_tween.start()
	party_move(position)

I have tried things like pixel snap and changing the physics frame rate to see if it makes a difference but there wasn't any change.

interpolate_callback is only supposed to be called once, not every frame in process. For most tween/timer like objects, you just set them up and call them and that is it, they run on their own. For interpolate_property, that is almost correct. You can replace velocity with null. This will use the current position rather than zero (which is almost always what you want). The last value you have as zero, this is the length of the tween, which should probably be something like 2.0 (for 2 seconds). That is why it doesn't work.

You've linked to a temporary image URL(see the /tmp/ in the address) as such the example image doesn't show.

Sorry the example didn't show, it was late at night when I posted this and I was tired so I wasn't paying much attention

I used zero as the last value for interpolate_property as using a value greater than zero causes the object to move towards the player like a magnet instead of repeating it's direct movements a moment later which is what I want it to do (like an rpg). With interpolate_callback, I put it in _process() as otherwise the object teleports towards the player's position after the delay when I want it to move smoothly. Currently the following itself works how I want it to (with the exception of having it stop when the player stops but I will add that in eventually), it's the frequent jitter that I am having difficulty with. I think it could have something to do with interpolate_property's value being 0 but I can't really think of any alternative.

Well, my advice still stands. However, tween is not the right feature to use here. Tweens are for single animations, like something sliding onto the screen in a few seconds. If you need constant movement all the time, then don't use tweens and instead use lerp or linear_interpolate. Also, you want movement related updates to be in physics process (not process) otherwise you may get jitter if the character movement is based on move and slide. https://docs.godotengine.org/en/stable/tutorials/math/interpolation.html

I tried linear_interpolate - the jitter is gone now, thank you! However, I'm not sure how to get the player's direct movements without the use of tweens. Currently it works well but it doesn't stick to the player's 8 directional movement.

a year later