hello.
i am really new here and i get stuck with my 2D game project
i want the sprite to move with the mouse but ...
i was looking in the tutorial and dont found something
here is the code :
#include "DarkGDK.h" //Required Header File
int mouseX ;
int mouseY ;
void soundSetup (void)
{
dbLoadSound ( "twinnar3.wav" , 1) ;
}
void loadbitmap (void)
{
dbLoadImage ( "ball.bmp", 2) ;
dbLoadImage ( "Backdrop.bmp" , 1 ) ;
dbLoadImage ( " " , 3 ) ;
}
void DarkGDK ( void )//The Main Funtion for the Dark GDK
{
// in this application a backdrop is loaded and then several
// sprites are loaded, the sprites are targets!
loadbitmap () ;
dbSprite ( 1, 0 ,0 , 1 ) ;
soundSetup () ;
dbPlaySound ( 1 ) ;
dbLoopSound (1 ) ;
dbMaximizeWindow () ;
dbShowMouse () ;
dbPositionMouse ( mouseX, mouseY ) ;
dbSyncOn ( ); //Turn on Sync
dbSyncRate ( 100 );
// Set Sync Rate for screen:
// The lower it is, the faster the game runs but the visual effects will be bad.
// The higher the setting - the opposite will occour!
dbDisableEscapeKey ( ); //disable the "escape" key
dbRandomize ( dbTimer ( ) ); //use the clock to obtian random numbers more effieciently
while ( LoopGDK () )
{
dbMouseX () ;
dbMouseY () ;
dbSprite ( 2 , mouseX , mouseY , 2 ) ;
if ( dbEscapeKey ( ) ) // if the ecape key is pressed, the program will exit
break;
dbSync ( );//update the screen contents
}
// close the program //
// delete all the sprites
for ( int i = 1; i < 30; i++ )
dbDeleteSprite ( i );
// delete the backdrop image
dbDeleteImage ( 1 );
return;//return back to windows
}