Computer Science Canada Help me please |
Author: | adrianr2z [ Tue Mar 19, 2013 6:58 pm ] | ||
Post subject: | Help me please | ||
What is it you are trying to achieve? Trying to get an image to move across thescreen and when it hits the end of the screen, i want the loop to end and move on. Having the dragon move across the screen was pain cause I created a procedure and put it in my loop before have doing a CLS. Any way to make this more efficient? What is the problem you are having? Wont END! I set it so that the loop ends when the image has reached maxx (end of the screen) and move on with the code but it repeats and never ends. Describe what you have tried to solve this problem Everything I can. Many to remember.
Please specify what version of Turing you are using 4.1 |
Author: | Tony [ Tue Mar 19, 2013 7:15 pm ] | ||
Post subject: | RE:Help me please | ||
try this code:
|
Author: | adrianr2z [ Tue Mar 19, 2013 7:27 pm ] | ||||
Post subject: | Re: RE:Help me please | ||||
Tony @ Tue Mar 19, 2013 7:15 pm wrote: try this code:
Thanks for the help but it isn't what I wanted. I edited it so that instead of putting text, It would move onto the rest of my text however it didn't work and just repeated non stop. Here is all the code after it
By the way your code didn't work. When it hit the end of the screen, it didn't exit. |
Author: | Tony [ Tue Mar 19, 2013 9:46 pm ] |
Post subject: | RE:Help me please |
That's your code. I've just added some put statements to help you track what your own code is doing. It's all supposed to repeat -- as the animation is inside of a loop. |
Author: | adrianr2z [ Tue Mar 19, 2013 10:04 pm ] | ||
Post subject: | Re: RE:Help me please | ||
Tony @ Tue Mar 19, 2013 9:46 pm wrote: That's your code. I've just added some put statements to help you track what your own code is doing.
It's all supposed to repeat -- as the animation is inside of a loop. It's repeating forever though... I don't want it to repeat forever. I'm trying to make the loop stop once the image hit the side of the windows (once it his maxx) and move on to clearing the screen and displaying
|
Author: | Tony [ Tue Mar 19, 2013 10:16 pm ] |
Post subject: | Re: RE:Help me please |
adrianr2z @ Tue Mar 19, 2013 10:04 pm wrote: It's repeating forever though...
but that's exactly what loop does! Quote: A loop statement causes the statements (and declarations) in it to be repeatedly executed. This continues until terminated by one of its enclosed exit statements (or by an enclosed return or result statement). |
Author: | adrianr2z [ Tue Mar 19, 2013 10:22 pm ] | ||
Post subject: | Re: RE:Help me please | ||
Tony @ Tue Mar 19, 2013 10:16 pm wrote: adrianr2z @ Tue Mar 19, 2013 10:04 pm wrote: It's repeating forever though...
but that's exactly what loop does! Quote: A loop statement causes the statements (and declarations) in it to be repeatedly executed. This continues until terminated by one of its enclosed exit statements (or by an enclosed return or result statement). Oh I thought there was a way to end a loop by saying when this happens... Then how do I do what I want? I'm so frustrated that I can't get a simple picture to hit the end of screen and just move on. Here is a sample code of my friends and this is what I want to happen however I was wondering if you can break it down cause I don't understand it
UPDATE! OH MY GOD! WOW! I DELETED THE LOOP AND AFTER IT WENT ON TO THE REST OF THE CODE! WOW! I THOUGHT THE LOOP WAS NEEDED TO HAVE THE PICTURE MOVE FORWARD! YESSSSSSSSS! OH MY GOD! I SPENT HOURS FIGURING WHY IT KEPT LOOPING! I DIDN'T NEED THE GOD DAMN LOOOOOOOOOOOOP! WOOOOHOOOOOOOOOOOOOOOOOOOOOOOOOOOO |
Author: | adrianr2z [ Tue Mar 19, 2013 10:27 pm ] |
Post subject: | Re: Help me please |
One more question, I have dragon right however when it's going across the screen, the background covers my other image which is a cloud. I was wondering, How do i send the dragon image to the background so that cloud is on front and doesn't get covered by the dragon image? |
Author: | Tony [ Tue Mar 19, 2013 10:49 pm ] | ||
Post subject: | RE:Help me please | ||
re: loops -- frustration just clouds your judgement. Sometimes you need to step back and examine exactly what your code is doing in detail. A simple exercise to illustrate how nested loops work:
For drawing stuff -- it sounds that you need to draw parts in the order that you want them to layer. So if you want the cloud in the very front, you would need to draw it last. |
Author: | adrianr2z [ Tue Mar 19, 2013 11:05 pm ] | ||
Post subject: | Re: RE:Help me please | ||
Just when I thought everything is ok, It actually isn't :/ So Previous code was procedure and I couldn't get the clouds to be written last because they were part of the procedure. Deleted the procedure and now I have another problem. Image leaves a trail even with offscreen and view.update + my clouds disappear :/ Decided to copy all my code just so you can see what the hell is going on and test it for yourself if possible. I really want to keep it as procedure but if that isn't possible, what do I do???
What am I doing wrong???? Why can't I do a simple animation without screwing everything else up. Gets so frustrating... |
Author: | Tony [ Tue Mar 19, 2013 11:18 pm ] | ||
Post subject: | Re: RE:Help me please | ||
adrianr2z @ Tue Mar 19, 2013 11:05 pm wrote: Image leaves a trail
Where do you clear the screen from the previous drawing? That is
Is this an animation leaving a trail, do did I mean to draw 100 circles on the screen as a pattern? |
Author: | adrianr2z [ Tue Mar 19, 2013 11:38 pm ] | ||
Post subject: | Re: RE:Help me please | ||
Tony @ Tue Mar 19, 2013 11:18 pm wrote: adrianr2z @ Tue Mar 19, 2013 11:05 pm wrote: Image leaves a trail
Where do you clear the screen from the previous drawing? That is
Is this an animation leaving a trail, do did I mean to draw 100 circles on the screen as a pattern? I DID CLS AND NOW IT DELETES EVERYTHING! HOW DO I FIX THIS! I'VE SPENT A WHOLE DAY TRYING TO DO THIS! WHAT DO I DO! the dragon trail is fine just the stupid thing deletes everything |
Author: | adrianr2z [ Wed Mar 20, 2013 12:39 am ] |
Post subject: | Re: Help me please |
I tried repositioning everything to make it work but no luck. The cls fixes the trail problem but causs further problems by clearing everything else. |
Author: | Tony [ Wed Mar 20, 2013 1:00 am ] |
Post subject: | RE:Help me please |
That's what cls does, it clears the screen, so you can draw new stuff Quote: The cls (clear screen) procedure is used to blank the output window. It's as good as Draw.FillBox(0,0,maxx,maxy,background_color) If you want to draw a smaller box, you can specify the dimensions directly. Ultimately you always draw new stuff on top of the old stuff. If something is missing because of movement, just draw it again, in the correct position. |