Skip to main content

why not create a list of enemies in the level so the draw becomes:

List<GenericEnemy> enemies;//filled during construction
Render(){
     
    //Render elements common to all levels
    draw(background);
    draw(playerSprite);
    for(GenericEnemy enemy : enemies) {
        draw(enemiesenemy);
    }    
}

where GenericEnemy is a superclass of all enemy types, then you only need one Scene class

why not create a list of enemies in the level so the draw becomes:

List<GenericEnemy> enemies;//filled during construction
Render(){
 
    //Render elements common to all levels
    draw(background);
    draw(playerSprite);
    for(GenericEnemy enemy: enemies)
        draw(enemies);

}

where GenericEnemy is a superclass of all enemy types, then you only need one Scene class

why not create a list of enemies in the level so the draw becomes:

List<GenericEnemy> enemies;//filled during construction
Render(){    
    //Render elements common to all levels
    draw(background);
    draw(playerSprite);
    for(GenericEnemy enemy : enemies) {
        draw(enemy);
    }    
}

where GenericEnemy is a superclass of all enemy types, then you only need one Scene class

Source Link
ratchet freak
  • 8.1k
  • 20
  • 16

why not create a list of enemies in the level so the draw becomes:

List<GenericEnemy> enemies;//filled during construction
Render(){

    //Render elements common to all levels
    draw(background);
    draw(playerSprite);
    for(GenericEnemy enemy: enemies)
        draw(enemies);

}

where GenericEnemy is a superclass of all enemy types, then you only need one Scene class