You need to use the dbATANFULL Command , try this :
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
//to store mouse position
double mousex;
double mousey;
//to store sprite position
double spritex;
double spritey;
//we need these to calculate the distanse between mouse and sprite
double distx;
double disty;
double angle;
//load your sprite image here
dbLoadImage("sprite.png",1);
dbSprite(1,300,300,1);
while ( LoopGDK ( ) )
{
mousex = dbMouseX();
mousey = dbMouseY();
spritex = dbSpriteX(1);
spritey = dbSpriteY(1);
distx = mousex - spritex;
disty = mousey - spritey;
angle = -dbATANFULL(distx,disty);
dbRotateSprite(1,angle);
dbSync ( );
}
return;
}