I'm having trouble getting a mouse to bounce around aimlessly inside of a maze. I created a maze sprite, and I have the mouse constantly moving in the pointed direction at 3 steps. However, while touching the maze sprite, I have him moving -3 steps to ensure he doesn't cross the boundary while also rotating at 1 degree. This works for a while, but eventually he just gets stuck on the maze boundary and rotates in circles forever! I've tried changing the rotating degrees and that didn't work. Also, if I change the sprite to a circle, this solves the problem of the sprite getting stuck on the maze border, but no matter what, the sprite will still get stuck in some random short bouncing pattern. Here is an image below. I appreciate your help! http://imgur.com/NOPzZwE
I was able to solve my problem with the following code. I also had to develop a layer called nodes, for the points on the maze in which the mouse may need to turn without bumping into a wall. If I didn't had this node layer, then the mouse would never enter certain parts of the maze. I added variables so that I would easily be able to add multiple mouses and change all the variables at once from the first master mouse.