Hi all,
I have written some code which essentially changes direction when touching the wall and moves on but I haven't been able to make the sprite automatically enter 'open doors' or 'gaps' in the maze wall. It will only change direction if it hits the maze wall itself. I will post a screenshot of my code
http://content.screencast.com/users/SPengilley/folders/Default/media/36e9c1e1-a22e-47f9-8d6f-8a71469d267f/maze-automate.bmp" width="496" height="542" border="0"
Offline
You could solve many of the problems by making "checks" that test all four sides of your sprite. You can either make one for each side, or a single one with different colors on each side, but the premise is the same.
Have these sensors check if a side of the sprite is facing an open space in the maze with an "If touching color..." block. Then have it evaluate if that open space would lead in the direction the sprite needs to take to reach its goal.
Does that make sense?
Offline
I like Harakou's idea better but you could also just use a hidden sprite that sits in the middle of a door or opening. The player sprite could wait till it is close enough, then if direction = whatever set direction to whatever
Offline