Object following player in platformer

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

I’m trying to create a platformer for a game jam where a cat follows the player. You have to lead the cat to the end. I’m trying to figure out how I could make it so that the sprite follows the player, but I could only find stuff about enemy pathfinding.

:bust_in_silhouette: Reply From: lewis glasgow
vel = Vector2()
vel.distence_to(player_global_pos)

if global_position.x < player_global_pos:
	$sprite.scale = -1
else:
	$sprite.scale = 1

move_and_slide(vel, Vector2.UP)
:bust_in_silhouette: Reply From: yrtv

A* already implemented in Godot, just use it.