I was working in an bomberman custom mini-game and noticed the hard way to make the player walk inside the walls without getting stuck in every single corner, due to the collision system being so simple.
Well, this lead me to a custom movement system, where I do the movement preventing collisions and making the turns smooth like the original game, instead of the 8-ways system, where it will stuck in the corner almost every turn...
To prevent stuck in the corner, I used the caterpillar RPG Maker concept, improved with a 2D array.
https://www.scirra.com/arcade/tutorial- ... ower-13553
Feel free to ask for help in your follower, caterpillar, shadow movement, clone, pet, system.
The concept here is store in the array everything you need, and vary the range where you pick your data to make the delay (milliseconds). In the sample I used 20ms, also did a condition to hold the follower 40 pixels far from the player, plus, only store data in the array while moving.