I was able to load the background (and some sprites as well)but now, I seem to be having some other issues. The little program I've been working on is supposed to simulate the roll of rice, and display pictures of the dice when rolled. The problem is, every once in a while only one of the dice shows up on the screen. when I compile this code:
#include "DarkGDK.h"
#include "windows.h"
#include <ctime>
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbDisableEscapeKey ( );
dbLoadImage ( "dicerollbd.bmp", 10 );
dbSprite ( 10, 0, 0, 10 );
dbSetImageColorKey ( 255, 0, 255 );
srand(time(0));
int roll1 = (rand() % 6) + 1;
int roll2 = (rand() % 6) + 1;
if (roll1 == 1)
{
dbLoadImage ( "dice1.bmp", 1);
dbSprite (1, 200, 200, 1);
}
if (roll1 == 2)
{
dbLoadImage ( "dice2.bmp", 2);
dbSprite (2, 200, 200, 2);
}
if (roll1 == 3)
{
dbLoadImage( "dice3.bmp", 3);
dbSprite (3, 200, 200, 3);
}
if (roll1 == 4)
{
dbLoadImage( "dice4.bmp", 4);
dbSprite (4, 200, 200, 4);
}
if (roll1 == 5)
{
dbLoadImage( "dice5.bmp", 5);
dbSprite (5, 200, 200, 5);
}
if (roll1 == 6)
{
dbLoadImage( "dice6.bmp", 6);
dbSprite (6, 200, 200, 6);
}
if (roll2 == 1)
{
dbLoadImage ( "dice1.bmp", 1);
dbSprite (1, 300, 200, 1);
}
if (roll2 == 2)
{
dbLoadImage ( "dice2.bmp", 2);
dbSprite (2, 300, 200, 2);
}
if (roll2 == 3)
{
dbLoadImage( "dice3.bmp", 3);
dbSprite (3, 300, 200, 3);
}
if (roll2 == 4)
{
dbLoadImage( "dice4.bmp", 4);
dbSprite (4, 300, 200, 4);
}
if (roll2 == 5)
{
dbLoadImage( "dice5.bmp", 5);
dbSprite (5, 300, 200, 5);
}
if (roll2 == 6)
{
dbLoadImage( "dice6.bmp", 6);
dbSprite (6, 300, 200, 6);
}
//BREAK
if (roll2 == 1 && roll1 == 1)
{
dbLoadImage ( "dice1.bmp", 1);
dbSprite (1, 200, 200, 1);
dbLoadImage ( "dice1.bmp", 1);
dbSprite (1, 300, 200, 1);
}
if (roll2 == 2 && roll1 == 2)
{
dbLoadImage ( "dice2.bmp", 2);
dbSprite (2, 200, 200, 2);
dbLoadImage ( "dice2.bmp", 2);
dbSprite (2, 300, 200, 2);
}
if (roll2 == 3 && roll1 == 3)
{
dbLoadImage( "dice3.bmp", 3);
dbSprite (3, 200, 200, 3);
dbLoadImage( "dice3.bmp", 3);
dbSprite (3, 300, 200, 3);
}
if (roll2 == 4 && roll1 == 4)
{
dbLoadImage( "dice4.bmp", 4);
dbSprite (4, 200, 200, 4);
dbLoadImage( "dice4.bmp", 4);
dbSprite (4, 300, 200, 4);
}
if (roll2 == 5 && roll1 == 5)
{
dbLoadImage( "dice5.bmp", 5);
dbSprite (5, 200, 200, 5);
dbLoadImage( "dice5.bmp", 5);
dbSprite (5, 300, 200, 5);
}
if (roll2 == 6 && roll1 == 6)
{
dbLoadImage( "dice6.bmp", 6);
dbSprite (6, 200, 200, 6);
dbLoadImage( "dice6.bmp", 6);
dbSprite (6, 300, 200, 6);
}
while ( LoopGDK ( ) )
{
if ( dbEscapeKey ( ) )
break;
dbSync ( );
}
return;
}
It works like a charm, just for the issue I stated above. What could be causing this?
Thanks in advanced!
ps. if you need the program just ask
Learning C++
Proud member of www.codecall.com