Ms. Chun,
A way to do this is to have an if statement which checks the condition of x and y position, and if it's true and over the edge +400 or -0 you could have the sprite rotate 180 degrees and continue on its path.
In the example they have created sprites that are the edges and then used the bounceOff block (might need to use text based programming for that character.bounceOff(edge)
). This way you are creating additional sprites to interact with.
Let me know if that helps!
Brad