Computer Science Canada Fixing the flicker in my program |
Author: | Darkmantis [ Sat Jun 03, 2006 7:04 pm ] | ||
Post subject: | Fixing the flicker in my program | ||
hey I have this pong that i made but the program seems to slow down alot when the paddles move and the ball constantly flickers. Some people suggest to put "offscreenonly" and View.Updates in my program but the problem is I dont know where to put them, here is my code.
|
Author: | MysticVegeta [ Sat Jun 03, 2006 7:09 pm ] |
Post subject: | |
the setscreen ("offscreenonly") goes above the drawing loop and your View.Update seems to be in the right place... |
Author: | Cervantes [ Sat Jun 03, 2006 7:10 pm ] | ||
Post subject: | |||
View.Set("offscreenonly") goes wherever you want to induce double buffering. The start of your program is a good place. You can inlcude offscreenonly with the other commands in your View.Set string. View.Update goes wherever you want to flip the back buffer into view. This is probably after you've drawn everything in your main loop.
|
Author: | Darkmantis [ Sat Jun 03, 2006 9:32 pm ] | ||
Post subject: | |||
Thx guys the flickering is now gone but now I have to fix a bunch of bugs but I have no Idea where to start, my ball now eats the obstacles more then before and now my paddles arent erasing themselves, heres the code.
|
Author: | Darkmantis [ Wed Jun 07, 2006 10:42 am ] |
Post subject: | |
Is there anyone who will help me out? |
Author: | Remm [ Wed Jun 07, 2006 2:27 pm ] |
Post subject: | |
take off nocursor so it is possible to see what is typed. If you dont want it visible for your 'click to continue' stuff, you could always change it to a mouse click anywhere on screen to continue, or put nocruisor on then and take it off (though i tried that and it didint work for me ![]() anyways, nice startup with the fade in/out, Although it leaves a bit of residue in the end. In game everythign seems to be going uber fast, so you might wannna add some delays in the ball and movement keys. |
Author: | Remm [ Wed Jun 07, 2006 2:31 pm ] |
Post subject: | |
Uh, sorry to double post but i just tried out the first one you posted, and it works fine - on my computer anyways... how badly is it flickering for you? i only see minor flickers in the paddle and ball. |
Author: | Clayton [ Wed Jun 07, 2006 2:36 pm ] |
Post subject: | |
actually for you to be able to see what you have typed you have to either take off 'offscreenonly' using 'nooffscreenonly', or you can View.Update after every letter you have typed (i wouldnt suggest doing that) check out my View.Set tutorial at : http://compsci.ca/v2/viewtopic.php?t=12533 to read all you need on View.Update ![]() |
Author: | Darkmantis [ Wed Jun 07, 2006 3:03 pm ] |
Post subject: | |
I still dont see how to fix my program ![]() ![]() |
Author: | Clayton [ Wed Jun 07, 2006 3:59 pm ] |
Post subject: | |
did you actually read my tut? you have to use Draw.Cls to clear the screen, not just draw over the items you want to move, also, you arent even getting rid of the paddles in question, resulting in the "smearing" of the paddles |
Author: | Darkmantis [ Wed Jun 07, 2006 9:00 pm ] |
Post subject: | |
The problem is I dont want to clear the entire screen |
Author: | HellblazerX [ Wed Jun 07, 2006 9:02 pm ] |
Post subject: | |
Then use Draw.FillBox. Just draw a white box over whatever portion of your picture you need to erase. |
Author: | Darkmantis [ Thu Jun 08, 2006 6:31 am ] |
Post subject: | |
Thats what I'm doing but it doesnt work when useing View.Update. |
Author: | HellblazerX [ Thu Jun 08, 2006 6:44 am ] |
Post subject: | |
Use View.UpdateArea. It only updates the one area you specify. |
Author: | Clayton [ Thu Jun 08, 2006 7:39 am ] |
Post subject: | |
the reason drawing over the objects you want to move doesnt work for you is..... you arent doing it! nowhere in your loop are you drawing over the paddles then redrawing them |
Author: | Darkmantis [ Thu Jun 08, 2006 6:24 pm ] | ||
Post subject: | |||
Yes I am drawing over my paddle and then redrawing, superfreak! Its right here in part of my code :
and thanks hellblazer Ill try the View.Update Area ![]() |
Author: | TheOneTrueGod [ Thu Jun 08, 2006 6:59 pm ] | ||
Post subject: | |||
Trace through your code linearly Darkmantis wrote:
Allright, first its going to erase at the paddles location, then it draws at the paddles current location, then it moves the paddle then it erases at the current location... Notice anything funny there? Its going to erase at the new position |
Author: | Darkmantis [ Fri Jun 09, 2006 10:33 am ] |
Post subject: | |
well it worked perfectly until I added View.Updates |
Author: | TheOneTrueGod [ Fri Jun 09, 2006 2:22 pm ] |
Post subject: | |
It shouldn't have... |
Author: | Hack.saw [ Fri Jun 09, 2006 7:47 pm ] | ||||
Post subject: | |||||
in alot less technical terms to use setscreen ('offscreenonly") you put a View.Update after a group of things u want to see happen. If you dont hte computer stores the inforamtion and u dont get to see it. EX:
and this will:
View.Updates usually go before delays also. |