With LibGDX comes a example which use the MVC pattern.
the updater looks something like this
List<Enemies> enemies = new List<Enemies>();
public void update() {
updateEnemies();
checkCollision();
}
void updateEnemies() {
for each enemy //Loop enemies list{
enemy.update();
}
}
void checkCollison(){
for each enemy//Loop enemies list{
if(enemy.overlaps(hero.bounds) {
//Do stuff
}
}
}
Now it loops through enemeies list twice. Should I do this? Maybe not one small list but I want to add lots of lots of lists so should I merge them?
Cheers!