Flickering Sprite

Advanced game related topics
Steve Elliott2
User
User
Posts: 42
Joined: Sat Jun 20, 2015 1:47 pm

Flickering Sprite

Post by Steve Elliott2 »

Hi,

I've decided to give the latest version of Pure BASIC a go for games.

Loading and displaying the background sprite leads to flickering at first until things settle down - then the flickering stops.
I'm guessing it's something to do with flip, but I've tried all sorts of combinations, with no luck.

Code: Select all

UsePNGImageDecoder()

If InitSprite() And InitKeyboard() And OpenScreen( 1920, 1080, 32, "GameGrid", #PB_Screen_WaitSynchronization )

    img = LoadSprite(  #PB_Any, "Gamegrid.png" )
    col_cls.i = RGB( 0, 0, 0 )
    
    If img

        Repeat
 
            ClearScreen( col_cls )
            StartDrawing( ScreenOutput() )
                DisplaySprite( img, 0, 0 )
            StopDrawing()
            FlipBuffers()
            ExamineKeyboard()
            
        Until KeyboardPushed( #PB_Key_Escape )
        FreeSprite( img )
        
    EndIf

EndIf

Steve
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Flickering Sprite

Post by Shield »

You don't need Start / StopDrawing for displaying sprites. :wink: Just remove it.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Steve Elliott2
User
User
Posts: 42
Joined: Sat Jun 20, 2015 1:47 pm

Re: Flickering Sprite

Post by Steve Elliott2 »

Awesome! Thanks, I've been playing around with that code for ages lol...Works perfectly now :D
Steve Elliott2
User
User
Posts: 42
Joined: Sat Jun 20, 2015 1:47 pm

Re: Flickering Sprite

Post by Steve Elliott2 »

It seems Pure BASIC has come on since I last looked regards gaming. Good Sprite routines, alpha blending, pixel perfect collisions, 3D - and 64-bit! :)

Onwards and upwards with my game...

And a library for Pure ;)
Post Reply