School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,444 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,528 people online right now. Registration is fast and FREE... Join Now!




Dark GDK loading animations

 

Dark GDK loading animations, dbLoadAnimations

AGRAC393

3 Jul, 2009 - 10:52 AM
Post #1

D.I.C Head
**

Joined: 13 May, 2009
Posts: 229



Thanked: 2 times
My Contributions
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;



User is offlineProfile CardPM
+Quote Post


chris772

RE: Dark GDK Loading Animations

5 Jul, 2009 - 08:18 PM
Post #2

D.I.C Head
**

Joined: 13 Mar, 2009
Posts: 166



Thanked: 2 times
My Contributions
Have you loaded them into the contents? you need to go into the solution explorer and right click on the project. Then select "Add existing item" and select your images and sounds et cetera.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 01:37AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month