Why do you create animated sprite when the backdrop is just one picture without animation? A simple sprite is enough.
In your code, these lines seem OK at first sight:
if ( dbRightKey() )
bdropX -= velocity;
else if ( dbLeftKey() )
bdropX += velocity;
However, then you position the sprite first at X, then at X-1024... And I don't understand this part:
if ( bdropX >= screenf || bdropX <= screenf ) //find end //of right-screen, cartesian system
{
bdropX = 0.0f;
//bdropY = 0.0f;
}
What is the screenf value? You adjust bdropX back to zero regardless if it is greater or smaller than screenf - in other words, you always set it back to zero. If this statement is within your main loop, then probably that's why the position of your backdrop does not want to change. (Is that what you meant by "sticking?")
Is the backdrop picture large enough to cover horizontally the entire level or does it only cover the visible window? Depending on the size of your background image, the result may be that part of the background will be empty after scrolling, since part of the picture will slide off the screen. This can be solved by making two copies of the picture and sticking them after each other.
Alternative idea: To scroll the backdrop, you can also try texture scrolling. By changing the texture coordinates, you can create the illusion of movement without actually moving the sprite. I made a texture scrolling implementation in the side-scroller demo in the Dark GDK coding challenges thread. Here are the relevant lines:
dbSetSpriteTextureCoord(sprBackground, 0, 0 + TexScroll, 0);
dbSetSpriteTextureCoord(sprBackground, 1, 1 + TexScroll, 0);
dbSetSpriteTextureCoord(sprBackground, 2, 0 + TexScroll, 1);
dbSetSpriteTextureCoord(sprBackground, 3, 1 + TexScroll, 1);
sprBackground is the number of the background sprite. TexScroll is the amount how much the texture must be scrolled. It is applied to all four corners of the image. The TexScroll value can be positive or negative (left or right).
You only need to find out a suitable calculation method for this TexScroll value. There is a calculation method in my demo, but I calculated screen left edge position instead of player position which may not be good for you. Try to calculate the background movement from the player velocity.