Computer Science Canada Animation exiting before executing final for loop |
Author: | jinjin [ Sat Apr 12, 2008 11:59 am ] | ||
Post subject: | Animation exiting before executing final for loop | ||
Hi everybody, I am currently creating an animation program for my Grade 10 CompSci class and everything works fine and looks good until the final for loop. Here is the animation so far:
The for loop at the end which wipes the screen with an expanding dark circle and then a white circle does not work. All that happens at the end is that it delays for a few seconds and then the screen goes white. I am not sure why this code does not work as I have tried running the loop by itself (without all the other animation code) and it works fine. Any help is appreciated. Thanks jinjin |
Author: | CodeMonkey2000 [ Sat Apr 12, 2008 12:06 pm ] |
Post subject: | RE:Animation exiting before executing final for loop |
Did you use View.Update in the loops? |
Author: | jinjin [ Sat Apr 12, 2008 12:48 pm ] |
Post subject: | Re: RE:Animation exiting before executing final for loop |
CodeMonkey2000 @ Sat Apr 12, 2008 12:06 pm wrote: Did you use View.Update in the loops?
Ah, you're right, that was the problem. It works perfect now, thanks CodeMonkey |
Author: | jinjin [ Sat Apr 12, 2008 1:38 pm ] | ||
Post subject: | Re: Animation exiting before executing final for loop | ||
Sorry for the double post but there is a new problem with the same program. When I try looping the entire animation so that it will loop forever, it works fine for the first time it runs but for the second time it runs, the program skips the first loop and goes onto the for loop. Plus, it leaves an unusual traced shape in the background on its second run. Here's the updated code:
Once again, any help is appreciated. Thanks |
Author: | BigBear [ Sat Apr 12, 2008 1:56 pm ] | ||
Post subject: | Re: Animation exiting before executing final for loop | ||
The first loop is skipped because your exit statement is true.
It goes through the first time and increases num1 but it is already = 200 the second time. Just re declare your variables in the beginning of your loop. Also for me the last giant growing white circle didn't quite erase everything, I just increased 430 to 530 but if it works for you it's all good. Hope this helps, |
Author: | jinjin [ Sat Apr 12, 2008 2:21 pm ] |
Post subject: | Re: Animation exiting before executing final for loop |
Thanks BigBear, it loops perfectly now. I would have never thought about that exit statement. I'll remember to check those for the next time I make a looping animation as I am still new at this. Also, I think the white circle erased everything fine for me but thanks for the advice Regards, jinjin |