with your help i managed to solve my problem. now i have new questions:
1. i managed my collision between 2d and 3d object by creating an invisible sprite over my 3d object. so whenever i movy my 3d object the 2d object would move in the same direction and is always at the center. my question is: can do it the other way around? i want to move my 2d object and my 3d object will follow that 2d object and would always be at the center.
2. i want to create a homing missile
double calcangle(int one, int two)
{
long double x;
long double y;
long double angle;
x=dbSpriteX(two)-dbSpriteX(one);
y=dbSpriteY(two)-dbSpriteY(one);
angle=dbATANFULL(x,y);
return angle;
}
i used this to calculate the angle between my homing missile and the target.
dbMoveSprite(500,-1);
enemyangle=-calcangle(500,1050);
shootangle=dbSpriteAngle(500);
if(shootangle<enemyangle)
rotatespecial+=5;
if(shootangle>enemyangle)
rotatespecial-=5;
dbRotateSprite(500,rotatespecial);
with this code my homing missile can only be fired if my target is on the left side of my playership. if my target is on the right side my missile would turn to 90° after that to 270° after that to 90° again and so on while going down slowly.
i want my homing missile to work correctly.