You may be interested in the "path" module and the included Follower contraption in terms of top-down games http://beyondloom.com/decker/path.html
In terms of platformers, it's a bit tricker because of how controls work on Decker (essentially since it's designed to be compatible with mobile devices we can't read keyboards directly) but this post from Internet Janitor has some thoughts https://itch.io/post/10102065