fixed bugs A* bug, glitch of character after clicking outside the screen

fixed bugs A* bug, glitch of character after clicking outside the screen