
-----------------------------------
Luffy123
Fri May 25, 2012 9:56 pm

How to ensure shape doesn't go off screen?
-----------------------------------
So I have a shape from a class.

Then I move the shape by 10 pixels at a time and erase it then redraw it.

I have to ask the user to enter the distance to move the shape andd then it says to ensure it doesn't go off screen,

So I did everything but now I just need a way to make sure it doesn't go off screen.

How would I go about doing that? Is there already a method in turing that I can use? Or would I have to do something else. 

What would be the best possible way of doing this?

Thank you!

-----------------------------------
Amarylis
Fri May 25, 2012 10:22 pm

RE:How to ensure shape doesn\'t go off screen?
-----------------------------------
Make it so that the new x/y coordinate can't be bigger than maxx/maxy - sizeOfShape

-----------------------------------
blaffypoo
Sat May 26, 2012 7:51 am

RE:How to ensure shape doesn\'t go off screen?
-----------------------------------
only move the shape if the right side of the shape is less than maxx and the left side is greater than 0

-----------------------------------
turinggirl
Sun May 27, 2012 8:49 pm

Re: How to ensure shape doesn't go off screen?
-----------------------------------
Maxx-(image size) and maxy-(image size)

^now embed this in your program.
