im using the following two functions (one to create the bullet the other to move it), however, when moving a bullet sometimes it will stop moving and not delete until I overwrite it.
heres the functions I'm using. (I'll post a screenie as well to help you guys understand)
void EnemyShoot()
{
dbPlaySprite(enemy[0].Sprite,1,2,50);
bCount++;
if(bCount>=100)
bCount=0;
int SpawnX = dbSpriteX(enemy[0].Sprite);
int SpawnY = dbSpriteY(enemy[0].Sprite);
dbSprite(bCount+100,SpawnX,SpawnY,10);
bullet[bCount].Sprite = bCount+100;
bullet[bCount].Angle = dbSpriteAngle(enemy[0].Sprite);
bullet[bCount].DistNew = 0;
bullet[bCount].Velocity = 10;
bullet[bCount].Player = 1;
dbRotateSprite(bullet[bCount].Sprite, bullet[bCount].Angle+90);
dbMoveSprite(bullet[bCount].Sprite, 30);
dbRotateSprite(bullet[bCount].Sprite, bullet[bCount].Angle);
dbMoveSprite(bullet[bCount].Sprite, 50);
}
void MoveBullet()
{
for(int j=0; j<bCount; j++)
{
if(bullet[j].DistNew>20)
dbDeleteSprite(bullet[j].Sprite);
if(bullet[j].Sprite!=0)
{
dbMoveSprite(bullet[j].Sprite, bullet[j].Velocity);
bullet[j].DistOld=bullet[j].DistNew;
bullet[j].DistNew++;
if(bullet[j].DistOld==bullet[j].DistNew)
dbDeleteSprite(bullet[j].Sprite);
}
}
}