I was trying to think on how to make my sprites be drag and drop using a mouse making but i couldn't figure out how to code this. What i would like to do is that there is my main image, i'll drag and drop it on a specified location and then drop it making them now 2. But my problem is that i can't make another new sprites to be drag and drop not making the other one disappear.
Heres my code:
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbCreateAnimatedSprite(1, "archerfiring.png", 2, 2, 1);
dbCreateAnimatedSprite(2, "archerfiring.png", 2, 2, 2);
dbSprite(1, 0, 0, 1);
dbSetSpritePriority(1, 2);
while ( LoopGDK ( ) )
{
if(dbMouseClick() == 0)
{
dbSprite(2, dbSpriteX(2), dbSpriteY(2), 2);
dbPlaySprite(2, 1, 4, 290);
if(dbSpriteX(2) > 120 && dbSpriteX(2) < 240)
{
if(dbSpriteY(2) > 120 && dbSpriteY(2) < 240)
{
dbSprite(2, 121, 121, 2);
dbPlaySprite(2, 1, 4, 290);
}
}
}
if(dbMouseClick() == 1)
{
dbSprite(2, dbMouseX()-30, dbMouseY()-69, 2);
dbPlaySprite(1, 1, 4, 290);
}
dbSync ( );
}
return;
}
Thanks!