///////////////////////////////////
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
int i = 1;
while ( LoopGDK ( ) )
{
if( dbUpKey( ) )
{
while( dbUpKey( ) ); //wait for the key is released
dbLoadImage( "box.jpg", i, 1 );
dbSprite( i, dbRND( 640 ), dbRND( 480 ), i );
i++;
}
if( dbDownKey( ) )
{
while( dbDownKey( ) ); //wait for the key is released
i--;
dbDeleteSprite( i );
dbDeleteImage( i );
}
dbSync ( );
}
return;
}
///////////////////////////////////
I think that these codes for dynamic loading (dynamic sprite loading and dynamic image loading)
I found a problem...
1.when the program runs, it works correctly.
2.I pushed up key 3 times to load the dynamic sprites, it worked correctly.
3.when I pushed down key 3 times to delete the sprites I loaded, it worked correctly.
4.I pushed up key 3 time again to load the sprites 3 pieces on screen, it worked correctly.
5.but when I pushed down key to delete each sprite, it appears that the sprites on screen cannot be deleted.
6.why?
*NOTE if I did not delete the last sprite on screen when I pushed up key to load it or I pushed down key to delete it, it appears that it works correctly
[/code][code]