Hello I'm trying to get my game to update the screen and draw graphics on its own I kind of made it happen but it still flickers which you can see in this video I made just too showcase this problem

http://www.youtube.com/watch?v=9j_ZDHr1x_8

Now I really don't know what is causing this its really strange if you look at the code you will know what I mean


and here is the code of which the problem lies

http://pastebin.com/kvtaUqiM

any solutions would be great thanks :)

anyone with any ideas ?

?

I'm working with SDL & C++ at the moment, so I'll take a look at the video & pastebin when I get home tonight as I can't get to it at work. I had a similar issue when I first started, so maybe I'll notice something that fixed it for me.

I have a new problem I fixed the old one :D had to flip once every iteration of the main while loop but here is my new problem.

Is this the correct way to do animation in SDL / C++ because whats happening is when I set enemy1 = 0; or any other digit then when playing the game it causes the sprite to disappear for a couple of milliseconds

///////////////
               //OGK Timer
               ///////////////
          
            int Enemy1 = 0;

            //increment timer "Add too the value of timer"
            Enemy1++;
 
         //if Enemy1 equal any of those cases below
         switch(Enemy1)
         {
 
            case(0) : {EnemyFrame = 0;} break;
 
            case(2) : {EnemyFrame = 1;} break;
 
            case(4) : {EnemyFrame = 2;} break;
 
            case(6) : {EnemyFrame = 3;} break;
 
            case(8) : {EnemyFrame = 4;} break;
 
            case(10) : {EnemyFrame = 5;} break;
 
            case(12) : {Enemy1 = 0;} break;
 
 
         }
 
         //Puts OrangeGhostKnight Onto FrameBuffer
         OrangeGhostKnightRect = StorageRect[10];
         SDL_BlitSurface(OrangeGhostKnightSurf[EnemyFrame],NULL,Screen,&OrangeGhostKnightRect);

can anyone else help me with my problem I'm dieing for it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.