Background to sprite : flickering

BlitzMax Forums/BlitzMax Beginners Area/Background to sprite : flickering

Hi,
I have a sprite working just fine but when I try adding a background I get problems.The code below is correct but when I add a background image it flickers and the sprite doesn't show.

Any suggestions ? Thanks in advance.

Graphics 1280,854 'set gfx mode
Global FrameTimer = MilliSecs()
Global frame:Int = 0

Global myimage:TImage = LoadAnimImage("ko1.png",32,32,0,240)


Repeat

Cls

DrawImage myimage,50,50,frame

If MilliSecs() > FrameTimer + 100
FrameTimer = MilliSecs()
frame:+1
EndIf

If frame >239 Then frame = 0

Flip
FlushMem

Until KeyHit(KEY_ESCAPE)

Can you show us your code for the background?

Where ever the background is, it should be drawn to the screen after cls and before DrawImage of your sprite. Consider that the is screen like a hole that your looking down into. What goes in first sits at the bottom and what goes in last sits on all the stuff that went in before.

Hope that helps.

Could try enabling double buffer.

Could try enabling double buffer.

It's all written to the backbuffer in BlitzMax.
Seeing the code *with* the background will help.