right now I am working a space invaders type game. The initial screen is read from a text file that looks like
1111111111111114
1000000000000014
1000000000000014
1000000000000014
1000000000000014
1000000000000014
1000000300000014
1000000000000014
1111111111111114
then I load it into a two dimensional array called screen [ ] [ ]
then I run a switch statement
Then I have some movment controls and colision detection controls. Mind you this entire program is under a while loop and is always in constant refresh. As my program is getting bigger I noticed my screen is starting to blink. I realized this is because my program is constantly checking values, and redrawing the screen.Code:switch ( screen [ ] [ ] ) { case 1: printf ("*"); // wall barrier break; case 0: printf (" "); // open space break; case 3: printf ("X"); // users ship break; case 4: printf ("\n"); break; }
My theory is to only refresh the screen every one half second and force another screen refresh if an event happens (ie: my ship moves)
would that be sufficent enough so that my screen wouldnt look so... choppy?