[code]So I have this basic code:
[code]
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadImage( "back.bmp", 2);
dbCreateAnimatedSprite( 1, "block.bmp", 2, 1, 1);
while ( LoopGDK ( ) )
{
dbSprite(2, 0, 0, 2);
dbSprite(1, 200, 200, 1);
dbPlaySprite(1, 1, 2, 50);
dbSync ( );
}
return;
}
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:
So I have this basic code:
[code]
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadImage( "back.bmp", 2);
dbCreateAnimatedSprite( 1, "block.bmp", 2, 1, 1);
while ( LoopGDK ( ) )
{
dbSprite(2, 0, 0, 2);
dbSprite(1, 200, 200, 1);
dbPlaySprite(1, 1, 2, 50);
dbSync ( );
}
return;
}[/code]
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!
I can do this with my sprite by doing:
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadImage( "back.bmp", 2);
dbCreateAnimatedSprite( 1, "block.bmp", 2, 1, 1);
while ( LoopGDK ( ) )
{
dbSprite(2, 0, 0, 2);
dbSprite(1, 200, 200, 1);
dbPlaySprite(1, 1, 2, 50);
dbSync ( );
}
return;
}[/code]
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:
[code]
int b = 0;
dbLoadImage( "background.bmp", 1);
dbSprite(1, b, 0, 1);
b++
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
int b = 0;
dbLoadImage( "background.bmp", 1);
dbSprite(1, b, 0, 1);
b++
[/code]
I can do this with my sprite by doing:
[code]
int x = 200;
dbLoadImage( "sprite.bmp", 2);
dbSprite(2, x, 200, 2);
if(dbLeftKey())
{
x++;
}
int x = 200;
dbLoadImage( "sprite.bmp", 2);
dbSprite(2, x, 200, 2);
if(dbLeftKey())
{
x++;
}
[/code]
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 :-D