Restrict movement in maze

40 views
Skip to first unread message

Markus Lindinger

unread,
Jan 15, 2019, 10:01:17 AM1/15/19
to MIT App Inventor Forum

I'm trying to create an app with a sprite that chases me when I enter a certain range around it. When the screen initializes, the sprite is given a random heading of [random from 0 to 3] * 90. 
It is then supposed to move straight forward until it reaches a wall (indicated by a different canvas color). When it touches the wall it shall calculate a random heading that is different from the current one so as not to cross the wall.

However when I run the app, the sprite sometimes crosses the wall or turns when there is no wall in front of it.

Any help would be appreciated.
Maze_chaser.PNG
Reply all
Reply to author
Forward
0 new messages