I have this arraylist:
// Add predators
predators = new ArrayList();
for (int i = 0; i < predNum; i++) {
Creature predator = new Creature(random(width), random(height), 2);
predators.add(predator);
}
How can the statement be structured so that the last element from the predators
arraylist is removed every 500 frames? Does it need a loop of some sort?
if (frameCount == 500){
predators.remove(1)
}
See Question&Answers more detail:os