Computer Science Canada Flickering Castle |
Author: | skyler [ Mon May 22, 2006 10:27 am ] | ||
Post subject: | Flickering Castle | ||
hi, i'm designing a program and i have a castle that is flickering when the an object is moved above it, is there any way to prevent that . THANK YOU and here is the code.
|
Author: | MysticVegeta [ Mon May 22, 2006 10:33 am ] |
Post subject: | |
sure there is, set the screen to "offscreenonly" setscreen ("offscreenonly") (with quotes) and put "View.Update", before you end the loop ![]() |
Author: | skyler [ Mon May 22, 2006 11:32 am ] |
Post subject: | |
Thank you MysticVegeta for ur help , but what if i have more than one object moving, one after the other , and each object ends with "end for" statement , can i still use what you mentioned. |
Author: | Cervantes [ Mon May 22, 2006 11:42 am ] |
Post subject: | |
You can use as many View.Update's as you want. However, you should not use more than one View.Update per (for) loop. In this case, you're alright, since the movement of your 'objects' are each within their own for loops. |
Author: | skyler [ Mon May 22, 2006 12:05 pm ] |
Post subject: | |
Thank you Cervantes for ur reply, now i did that, i got another problem, every time i run the program , some objects which r not moving , r supposed to appear at the end but they dont until you click outside the window i.e: on the desktop here is the code. i uploaded the program , please choose the 2nd choice to see what i'm talking about. THANK YOU VERY MUCH. |
Author: | Cervantes [ Mon May 22, 2006 1:19 pm ] |
Post subject: | |
skyler wrote: every time i run the program , some objects which r not moving , r supposed to appear at the end but they dont until you click outside the window i.e: on the desktop
That's probably a missing View.Update. When a Turing program is finished executing and if the Turing run window becomes inactive [minimized, another window is selected...] (or something like that), the backbuffer is copied to the frontbuffer. That is, a View.Update automatically occurs at the end of the program. If you insert your own View.Update just before the end of the program, this problem should be solved. |
Author: | skyler [ Mon May 22, 2006 9:19 pm ] |
Post subject: | |
hi Cervantes, thank you for ur help , but i really got confused , so if you dont mind can u help me figure out where to put the View.Update in the program that i attached please , i really need ur help because i have to present the program tomorrow for the teacher, i'd be really grateful if u just tell me the place where it needs the View.Update in the program to prevent the problem i have. THANK YOU. |
Author: | skyler [ Mon May 22, 2006 9:24 pm ] |
Post subject: | |
Cervantes never mind my last reply, i figured out how to do it , of course with your great help , and i guess i'll get a good mark hopefully. THANK YOU |
Author: | skyler [ Mon May 22, 2006 9:54 pm ] | ||
Post subject: | |||
by the way do you know why the truck in the following program is flickering ???????? even though i used View.Update but it didn't solve the problem , can you help me with that. thank you.
|
Author: | MysticVegeta [ Mon May 22, 2006 10:08 pm ] |
Post subject: | |
ok first of all you dont need the crab and path (which are constants, meaning have nothing to do with the loop counter) inside the loop, just remove them from the loop. Second: you put View.Update below the delay(10) instead the end. Third: you should have setscreen("offscreenonly") |
Author: | skyler [ Mon May 22, 2006 10:23 pm ] |
Post subject: | |
WOW , thank alot that really made my program alot smoother , i dont know what to say but u guys are geniuses and this is the best forum ever. THANK YOU |
Author: | MysticVegeta [ Mon May 22, 2006 10:36 pm ] |
Post subject: | |
If you are wondering that View.Update makes the truck go slower then you could just put "by 5" or whatever #, "by 6", "by 7", etc, eg: "for move : 0 .. 250 by x" where x is any natural #. what that does is that it makes the loop goes by x, ok that didnt make sense. like if x is 5 then the loop will go 0 5 10 15 20 etc. if 6 then 0 6 12 18 etc. that makes the truck move faster since move is incrementing faster. |