hi.
im sorry for late reply.
anyway, im using dbPickObject().
here's my code
#include "DarkGDK.h"
int enemyhp1 = 125;
int enemyhp2 = 150;
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff ();
dbLoadImage ("crosshair.png",1);
dbSprite (1,0,0,1);
dbOffsetSprite (1,16,16);
dbSprite(1,dbScreenWidth()/2,dbScreenHeight()/2,1);
dbMakeObjectSphere (1,10);
dbPositionObject (1,dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ());
dbMakeObjectSphere (2,10);
dbColorObject(2,dbRGB(256,100,123));
dbPositionObject (2,104,0,123);
dbMakeObjectSphere (3,10);
dbColorObject(3,dbRGB(100,256,0));
dbPositionObject (3,211,0,21);
while ( LoopGDK ( ) )
{
dbControlCameraUsingArrowKeys (0,3,1);
dbSetObjectToCameraOrientation (1);
dbPositionObject (1,dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ());
dbPrint (dbStr (enemyhp1));
dbPrint (dbStr (enemyhp2));
if (dbMouseClick () == 1 && dbPickObject (dbScreenHeight()/2,dbScreenWidth()/2,1,2) == 2)
{
enemyhp1 -= 1;
}
if (dbMouseClick () == 1 && dbPickObject (dbScreenHeight()/2,dbScreenWidth()/2,1,3) == 3)
{
enemyhp2 -= 1;
}
if (enemyhp1 <= 0)
{
enemyhp1 = 0;
dbDeleteObject (2);
}
if (enemyhp2 <= 0)
{
enemyhp2 = 0;
dbDeleteObject (3);
}
dbSync ();
}
return;
}
i dont know why enemyhp1 and enemyhp2 only decrease when close range.
Rank : Beginner Coder
Im Indonesian, and I cant speak english, i hope you understand