Computer Science Canada box moving across screen help |
Author: | paintking [ Tue Nov 06, 2007 1:11 pm ] | ||
Post subject: | box moving across screen help | ||
hey i need help making my box move across the screen and then when it gets to the end of the screen it needs to come back to the starting location altho i have no clue how to do that can any one help please this is what i have so far
thanx for the help if i get any |
Author: | HeavenAgain [ Tue Nov 06, 2007 3:21 pm ] |
Post subject: | RE:box moving across screen help |
seems like everyone is doing this assignment, well stop and think for a second there. if (keyword) let say the box x reaches the maxx (keyword), instead of adding 1, you should subtract 1, correct? so use an if statement. |
Author: | CodeMonkey2000 [ Tue Nov 06, 2007 4:00 pm ] |
Post subject: | RE:box moving across screen help |
Before you make a new topic,please look at the first few threads, and make sure that you read through the Turing Walkthrough. |
Author: | Zampano [ Tue Nov 06, 2007 4:48 pm ] |
Post subject: | Re: box moving across screen help |
Don't use a separate variable for each coordinate in the location of the box. Instead have one corner be related to the others by a small addition statement. Also, use an increment to change the location of the x and y of the box, when the box reaches the end of the screen, an if will make the increment the negative of what it already is, thereby reversing the motion of the box. EDIT: The posters above are correct, simple problems like these are done to death. Is there any way we could have a visible link to the complete tutorial on the home page? |