hitting the planes
in
Programming Questions
•
1 year ago
i'm having trouble actually hitting the planes and when i'm changing the loops it seems to affect the other loops can anyone tell me whats wrong
void doBullets() {
for (int i = b.size()-1;i > 0; i--) {
if (b.get(i).outOfRange()) {
b.remove(i);
}
else {
b.get(i).display();
b.get(i).position();
}
}
}
void doPlanes() {
for (int i = 0; i < NumPlanes ; i++) {
if (p.get(i).outOfBounds()) {
p.remove(i);
}
else {
p.get(i).display();
p.get(i).move();
}
}
}
void doHitPlanes() {
for (int i = 0; i < b.size(); i++) {
for (int j =0 ; j >p.size() - 1; j--) {
if (p.get(j).isHit(b.get(i))) {
p.remove(i);
}
}
}
}
1