So I've embarked on my second program with the Dark GDK. It's been going great so far. What I've got now is a screen with a background, and clouds floating by. The problem is that when I add a animated sprite one of the clouds just stays at one point. When I take the code for the animated Sprite out, everything works fine.
Before animated sprite code:
#include "DarkGDK.h"
void DarkGDK ( void )
{
int k = -1150; // I is the x Coordinate used below
int a = -1200;
int b = -800;
int c = -300;
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetImageColorKey ( 255, 0, 255 );
dbLoadImage ( "fishbackgroundfinal2.bmp", 1);
dbLoadImage ( "land.bmp", 6);
dbLoadImage ( "cloud.bmp", 7);
dbLoadImage ( "cloud2.bmp", 3);
dbLoadImage ( "cloud3.bmp", 4);
dbLoadImage ( "cloud4.bmp", 5);
while ( LoopGDK ( ) )
{
dbSprite (1, 0, 0, 1);
//water Start
//nothing to see here
//water End
//Cloud Start
dbSprite (7, k, 25, 7);
k++;
if(k == 700)
{
k = -550;
}
dbSprite (3, a, 7, 3);
a++;
a++;
if (a == 1500)
{
a = -500;
}
dbSprite(4, b, 35, 4);
b++;
if (b == 900)
{
b = -300;
}
dbSprite(5, c, 30, 5);
c++;
if (c == 650)
{
c = -350;
}
//Cloud End
dbSprite (6, 0, 180, 6);
dbSync ( );
}
return;
}
With animated Sprite code:
#include "DarkGDK.h"
void DarkGDK ( void )
{
int k = -1150; // I is the x Coordinate used below
int a = -1200;
int b = -800;
int c = -300;
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetImageColorKey ( 255, 0, 255 );
dbLoadImage ( "fishbackgroundfinal2.bmp", 1);
dbLoadImage ( "land.bmp", 6);
dbLoadImage ( "cloud.bmp", 7);
dbLoadImage ( "cloud2.bmp", 3);
dbLoadImage ( "cloud3.bmp", 4);
dbLoadImage ( "cloud4.bmp", 5);
while ( LoopGDK ( ) )
{
dbSprite (1, 0, 0, 1);
//water Start
dbCreateAnimatedSprite(10, "water1.bmp", 1, 6, 10);
dbSprite(10, 265, 380, 10);
dbPlaySprite(10, 1, 6, 300);
//water End
//Cloud Start
dbSprite (7, k, 25, 7);
k++;
if(k == 700)
{
k = -550;
}
dbSprite (3, a, 7, 3);
a++;
a++;
if (a == 1500)
{
a = -500;
}
dbSprite(4, b, 35, 4);
b++;
if (b == 900)
{
b = -300;
}
dbSprite(5, c, 30, 5);
c++;
if (c == 650)
{
c = -350;
}
//Cloud End
dbSprite (6, 0, 180, 6);
dbSync ( );
}
return;
}
Any help? Thanks!
Learning C++
Proud member of www.codecall.com