Here's one I use but it's just a quick one that doesn't collide with the tilemap. Maybe it will help.
@nullstack oh! I check the source code on GitHub and found the solution, and....it works!!! the solution is:
after the if(_up||_down||_left||_right) statement add this:
Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.