The problem might be my fault... ive built FOR loops to try to cycle through every bullet and every enemy. basically just to learn the GDK im building a game that will be scrapped so when i build my real one i dont EFF it up.
I read that there is a way to use the collision function to just check collision with an object and return the value but i cant seem to make it work.
dbSpriteCollision(61 + i, 0) seems to return nothing so i built a for loop i obviously have issues with but need help on why collision wont work with the "0"
// Handle lazer impacts and tracking
for(i = 0; i < 5; i++)
{
for(int sel = 100; sel < 121; sel++)
{
if ( dbSpriteHit(61 + i, sel) > 0 )
{
if (sel == Enemy.ID[s])
{
Lazer.Impact[i] = sel;
dbHideSprite(61 + i);
Lazer.LazerY[i] = 1200;
Lazer.LazerX[i] = 1200;
Lazer.active[i] = 0;
sel = 121;
}
}
}
//IF active lazer connects with an enemy else ignore the collision and reset the Impact variable for that Lazer.
if ( Lazer.Impact[i] > 99 && Lazer.Impact[i] < 121 )
{
for(int sel = 0; sel < 21; sel++)
{
if (Enemy.ID[sel] == Lazer.Impact[i] && Enemy.State[sel] == ALIVE)
{
Enemy.Shields[sel] -= 10;
Lazer.Impact[i] = 0;
if (Enemy.Shields[sel] == 0 )
{
Enemy.State[sel] = EXPLODING;
dbHideSprite(Lazer.Impact[i]);
}
sel = 100;
}
}
}
else
Lazer.Impact[i] = 0;
//Track Active Lazers and Increment X-Axis
if (Lazer.active[i] == 1)
{
Lazer.LazerY[i] -= 12;
dbSprite(61 + i, Lazer.LazerX[i], Lazer.LazerY[i], 61 + i);
if (Lazer.LazerY[i] < -20)
{
Lazer.active[i] = 0;
Lazer.LazerX[i] = 1200;
Lazer.LazerY[i] = 1200;
dbSprite(61+i, Lazer.LazerX[i], Lazer.LazerY[i], 61+i);
dbHideSprite(61+i);
}
}
}
Saving the world, one bit at a time.... Wait it's not worth saving. Get your own bits!