Okay, I think this part of the code will hopefully be at least understandable. I realized my problem I think is a lack of understanding of dbSynch() and when to use it. Basically I want my sprite 2 to move around the grid image, and I want the sprites using image 3 to be created around sprite 2 and then stay there. This sort of works, but its very jumpy and things are drawn multiple times on the screen sometimes. Also, the setSprite command now seems to be necessary for the program to display right at all, which is a new thing. Thanks.
void DarkGDK ( void )
{
dbSetDisplayMode ( 355, 355, 32 );
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadImage ( "grid.bmp", 1 );
dbLoadImage ("sprite2.bmp", 2);
dbLoadImage ("discover.bmp",3);
dbSprite (1,0,0,1);
dbSprite (2,5,5,2);
for (int i = 0; i<10; i++)
{
for (int j = 0; j<10; j++)
{
explored[i][j] = 1;
}
}
int i = 0;
Person abe;
int x =0;
int y =0;
FOOD[9][2] = 99;
FOOD[2][9] = 99;
MOUNTAIN[2][2] = 99;
dbSetSprite (1, 0, 1 ); //I included this line to try and fix my old problem, now if I dont include it the background
//disappears, and even more confusingly the other sprites dont draw at all correctly either.
while ( LoopGDK ( ) )
{
for (int k = 0; k<100; k++)
{
//from here
abe.double_To_Integer();
abe.set_Noise();
abe.set_Sight();
abe.death();
abe.make_Insane();
abe.turn_Upkeep();
abe.death();
abe.set_Goal();
abe.double_To_Integer();
abe.find_Location();
x = abe.get_X();
y= abe.get_Y();
//to here is algorithm crap for the program, the important part is the values for
//the 'characters' x and y values are changing, as well as the values of the explored array
dbSprite ( 2, x*35 +5, y*35 +5, 2 );
for (int i = 0; i<10; i++)
{
for (int j = 0; j<10; j++)
{
if (explored[i][j] != 1)
{
dbSprite ( k, i*35 +5, j*35 +5, 3 );
dbSync ( );
}
}
}
dbWait(200); //So I can tell easier what is actually going on.
}
}
for (int i =1; i<4; i++)
{
dbDeleteImage(i);
}
for (int i =1; i<100; i++)
{
dbDeleteSprite(i);
}
return;
}
I hope the code isn't too long and annoying.