Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Background Covering Sprite

Author
Message
TeenCHristian
14
Years of Service
User Offline
Joined: 22nd Jun 2010
Location:
Posted: 26th Jul 2010 17:53 Edited at: 27th Jul 2010 16:29


My problem is this: When I load the block image using dbLoadImage()
you see the image on top of the background, but when I load it using dbCreateAnimatedSprite() it animates behind the background.
So basically the background covers the sprite when I use dbCreatAnimatedSprite(). How to I load an animated Sprite so it animates over the background?

Thanks in advanced![/code]


Edit: Ok so I solved that problem (and put it into a big code box), but now I have a new one. I want to scroll my background at a constant speed. So I think why not just do:



I can do this with my sprite by doing:


And it works fine. When I push the up key it moves up. And I wonder why can't I do that with my background. It's loaded on the screen like a sprite too. So I guess I'm confused why I can't move my background around like my sprite???

Thanks in advanced!!! Very thankful for help [/code]

So I just solved that problem and now I I have another one! So When I press space bar my background scrolls along, but when I release it, it stops. Is there a way to keep it scrolling with just one push of the space bar?

Thanks again!

Learning C++
Proud member of www.codecall.com
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 3rd Aug 2010 01:59
Try something like this:

bool backgroundscrolling=false;

if(dbReturnKey)
{
if(!backgroundscrolling)
{
backgroundscrolling=true;
}
}

//now the code for the background to scroll:

if(backgroundscrolling=true)
{
//scroll code here
}

basically you want to have a variable that once you press the return button get switched to true, then have your scroll code somewhere blocked off by an if statement checking if the background scrolling is true.

Login to post a reply

Server time is: 2024-11-19 20:41:18
Your offset time is: 2024-11-19 20:41:18