Hi Im having problems getting an animation/Sprite to move across the screen.
I have created a Startup screen, which displays a picture, a few sprites some text and a sound.
I have created a class called Startup, which displays the start screen and initiates the game. Within this class I have created a member function to display an animation on my startup screen.
my problem is getting it to move across the screen.
I have been playing with my code for ages and can't get it right
dbMoveSprite() does not seem to work
I have tried using a for loop which increasses the Sprites position each loop, but only my final position gets displayed, I Played around using dbSync() which finaly showed my animation moving but my background screen flickers!?
This iss my Main.cpp
#include \"library.h\"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbDisableEscapeKey ( );
dbSetImageColorKey (255,0,0);
Startup Start;
Start.SetPlay_Game(false);
PLAYER player;
player.SetPosition(250,250);
while ( LoopGDK ( ) )
{
if (Start.ShowPlayState()==false)
{
Start.Play_low_budge();
}
if (Start.ShowPlayState()==true)
{
dbShowSprite(1);
player.PlayerMovement();
}
if ( dbEscapeKey ( ) )
break;
dbSync();
}
for ( int i = 1; i < 30; i++ )
dbDeleteSprite ( i );
dbDeleteImage ( 1 );
return;
}
My startup screen gets displayed in Start.Play_low_budge();
#include \"library.h\"
void Startup::SetPlay_Game(bool playgame)
{
Play_Game=playgame;
}
bool Startup::ShowPlayState()
{
return Play_Game;
}
void Startup::PlayWb()
{
dbCreateAnimatedSprite(15,\"WB.bmp\",4,8,15);
dbSprite(15,10,10,15);
dbPlaySprite(15,1,10,10);
dbMoveSprite(15,-10);
}
void Startup::Play_low_budge()
{
dbLoadImage(\"Startgame.bmp\",10);
dbLoadImage(\"Hand.bmp\",11);
dbLoadImage(\"Hand.bmp\",13);
dbSprite(10,-70,-50,10); //background.
dbSprite(11,200,300,11);
dbHideSprite(10);
dbLoadSound(\"button.wav\",12);
dbSprite(1,10,10,10);
dbPasteSprite(10,-70,-50);
Startup::PlayWb();
dbText(250,300,\"Start Game\");
dbText(250,330,\"Options\");
if (dbDownKey()==1)
{
dbPlaySprite(5,1,10,1);
dbPlaySound(12);
dbCloneSprite(11,13);
dbSprite(13,200,330,13);
dbHideSprite(11);
dbShowSprite(13);
}
if (dbUpKey()==1)
{
dbPlaySound(12);
dbShowSprite(11);
dbSprite(11,200,300,11);
dbHideSprite(13);
}
if (dbSpaceKey()==1)
{
dbCLS();
dbDeleteImage(11);
dbDeleteSprite(11);
dbDeleteImage(12);
dbDeleteSprite(12);
dbDeleteImage(13);
dbDeleteSprite(13);
Startup::SetPlay_Game(true);
return;
}
}
The problem is in void Startup:
layWb() Im using dbMoveSprite() but it dosent move? any help please?
Thanks.