Hello all,
I'm new here to the Game Programming forum. Anyway, I'm starting some game things with Dark GDK and Blender for 3D modeling. I have a great tutorial that I got off this site (can't remember the creator, but it's useful!) and I would like to add an animation to the game. I have successfully loaded a .wav sound file, so now I want to add the "You Win 1" animation to the project. When I Start Without Debugging, I get no errors, and it loads fine, but when it gets to the part to play, no animation... It is in the same directory location as the .exe.
Here is the code
CODE
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn();
dbSyncRate ( 100 );
dbDisableEscapekey ( );
dbRandomize ( dbTimer ( ) );
dbLoadSound("DWTPGame.wav",21);
dbPlaySound(21);
dbLoadAnimation("youwin1.avi",22);
dbLoadImage ("backdrop.bmp", 1 );
dbSprite ( 1, 0, 0, 1 );
dbSetImageColorKey ( 255, 0, 255 );
int i = 1, T = 2, S = 3, P = 4;
dbLoadImage("target.bmp", T);
dbSprite ( T, 250, 0, T );
i++;
dbLoadImage("shooter.bmp", S);
dbSprite ( S, 200, 460, S );
dbLoadImage("PROJ.bmp", P);
int Z = 0;
int R = 1;
int M = 200;
int AC = 50;
int BC = 4;
while ( LoopGDK () )
{
int DIF = 2;//Difficulty *Make sure this number is either 2, 5, 10, or 50!;
if(R == 1)
{
dbSprite(T,Z, 1,T);
Z=Z+DIF;
if(Z==650)
{
R = 0;
}
}
else if(R == 0)
{
dbSprite(T,Z,1,T);
Z=Z-DIF;
if(Z == 0)
{
R = 1;
}
}
if( dbRightKey() && !(M > 625))
{
dbSprite(S, M, 460, S);
M = M + 2;
}
if( dbLeftKey() && !(M <= 0))
{
dbSprite(S, M, 460, S);
M = M - 2;
}
if( dbSpaceKey())
{
if(AC == 50)
{
dbSprite(P, M, 425, P);
AC = 0;
}
}
if(AC < 50)
{
dbMoveSprite(P, 10);
AC++;
}
if(AC < 50)
{
if((dbSpriteY(P) >= 0 && dbSpriteY(P) <= 10))
{
if((dbSpriteX(P) <= (dbSpriteX(T) + 20) && (dbSpriteX(P) >= (dbSpriteX(T) - 20))))
{
MessageBox(NULL, "You Won!, Click OK to exit.", "Congrats!", MB_OK);
dbPlayAnimation(22);
break;
}
}
}
if ( dbEscapeKey ( ) )
break;
dbSync ( );
}
for ( int i = 1; i < 30; i++ )
dbDeleteSprite ( i );
dbDeleteImage ( 1 );
return;
}
Here you can see that I declare/load the animation and assign it 22:
CODE
void DarkGDK ( void )
{
dbSetWindowTitle("Aaron's First 2D Game (Kind of...)");
dbSyncOn();
dbSyncRate ( 100 );
dbDisableEscapekey ( );
dbRandomize ( dbTimer ( ) );
dbLoadSound("DWTPGame.wav",21);
dbPlaySound(21);
dbLoadAnimation("youwin1.avi",22);
I would like it to play here:
CODE
if((dbSpriteX(P) <= (dbSpriteX(T) + 20) && (dbSpriteX(P) >= (dbSpriteX(T) - 20))))
{
MessageBox(NULL, "You Won!, Click OK to exit.", "Congrats!", MB_OK);
dbPlayAnimation(22);
break;