Main Menu

flickering

Started by andrik, February 06, 2007, 01:02:29 AM

Previous topic - Next topic

andrik

Hi,

I'm having difficulties with my cardgame I'm making.
When a player draws a card, I want to show the card moving from the stack to the hand of the player.

I use a loop which simplified look like this:


while startposition <> endpositiion
   
   x = x - 10
   y = y - 10
   update_gameboard()
   positionsprite l_card ,x,y
   drawsprite l_card
   
   sync
endwhile

The update_gameboard() function draws the backgroud, which consists of a table and all the cards lying on
the table and some text, etc.

Now when I draw a card, I can see the card move, but it flickers like hell while being moved.
What am I doing wrong? How can I make the flickering stop? Am I sync-ing to fast?

best regards,
Andrik

Ian Price

You've missed out a CLS RGB(XX,XX,XX) after the Sync command. That'll make a big difference. :)
I came. I saw. I played some Nintendo.

andrik

#2
I forgot in the code example,

I have CLS 0
as the first line within the loop.

Do I have to place it behind the sync? That doesn't matter, does it?

Could it have something to do with the framerate? I believe I set the framerate at 60, using
setfps 60

greetz,
Andrik

Ian Price

You can place the CLS command at the start or end of the loop so that should be OK. Settingthe FPS to 60 wouldn't make it flicker.

Without seeing more of your code it would be difficult to ascertain exactly why it's flickering, but my next bet would be that you are not using DrawAllSprites. It would appear that you are only displaying only the current l_card card (DrawSprite l_card) at any one time.

Try removing "DrawSprite l_card" and repolace with "DrawAllSprites"
I came. I saw. I played some Nintendo.

andrik

Ian,

I found the problem...while I said I had the framerate set to 60, now that I'm home looking a the code, I notice I had it set to 30.
Dumb.

Thanks for your trouble and quick replies.

Ian Price

I doubt that the 30 FPS was the problem, but if it's working now, then at least it's sorted.

No worries. :)
I came. I saw. I played some Nintendo.