Quote (RaiseIt @ 20 Nov 2018 22:37)
How about setting up the width/length to make sure the ball stays inside the screen
Use
Code
window_width()
and
Code
window_height()
methods on the Screen to obtain the width and height of your screen. Then you can just check if the turtle stays inside by:
Code
-width < x < width and -height < y < height
Where x and y are the turtle's current or new position after making a move. If it's the latter, you reset the turtle's position since it would be invalid.
This post was edited by Klexmoo on Nov 20 2018 03:18pm