Draw the total of a passed value, or value in general, without checking how many values there are individually.
Here's a pseudo-example:
1 2 3 4 5
|
int aliens = 10; // This should be changed as desired.
void drawaliens(int value)
{
aliens.draw(value); // Instead of having a test of how many to draw, draw the amount there is from one check
}
|
Don't get it? I'll explain even further if you don't:
I want to draw the amount of aliens passed or called to the alien draw function.
However, I don't want the function to check every possible value of aliens which could be passed before drawing, and just check the value once and draw that value.
IF x ALIENS, DRAW x ALIENS instead of...
IF 1 ALIEN, DRAW ALIEN(1);
IF 2 ALIEN, DRAW ALIEN(2);
IF 3 ALIEN, DRAW ALIEN(3);
.... and so on.
If there can be hundreds of aliens, it seems impractical to check every single possible value before drawing, and just check the value and draw that value.
However, I'm at a total blank as to how to do this in any conceivable, imaginable way(not a total noob to programming, but just can't get my head around this one problem).
ANY EXAMPLE will be preferred, such as you understand what I'm getting at here.