Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to ensure shape doesn't go off screen?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Luffy123




PostPosted: Fri May 25, 2012 9:56 pm   Post subject: 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!
Sponsor
Sponsor
Sponsor
sponsor
Amarylis




PostPosted: Fri May 25, 2012 10:22 pm   Post subject: 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




PostPosted: Sat May 26, 2012 7:51 am   Post subject: 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




PostPosted: Sun May 27, 2012 8:49 pm   Post subject: Re: How to ensure shape doesn't go off screen?

Maxx-(image size) and maxy-(image size)

^now embed this in your program.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: