title: How do I make a Scratch sprite bounce off the edge of a maze?
body: <p>I'm currently making a project, where I have a sprite that is controlled by the player, and it has to make its way through a maze-like stage:</p>
  
  <p><a href="https://i.stack.imgur.com/TrdvB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TrdvB.png" alt="enter image description here"></a></p>
  
  <p>The red box is the player. How do I make the player not be able to go through the black lines?</p>
  
  <p><sub>This question came up several times while I was mentoring at Scratch Day. I've provided a self-answer below, but I'd be interested in seeing other methods as well.</sub></p>