Using an array to draw multiple sprites (enemies)

WEll for a re-assignment i have to re-create the arcade game 'Frogger' and although i can draw one "enemy" have them move on their own and wrap around the screen what i can't figure out how to do is draw multiple enemies without have really long sets of code as their are a fair few enemies in frogger: the way i do it at the moment is like this, of course the code is put in the correct sections of my game.cpp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
e1.setPosX(1000);
e1.setPosY(550);
e1.setVelX(-35);

enemySprite=sf::Sprite(enemyImage);
enemySprite.SetCenter(enemySprite.GetSize().x/2,enemySprite.GetSize().y/2);

win->Draw(enemySprite);

if(elapsedTime>1.0F/FRAMERATE)
{

	e1.setPosX(e1.getPosX() + elapsedTime * e1.getVelX());
	Clock.Reset();

}

	if (e1.getPosX() < -55) //wrap function for the x axis
	{
		e1.setPosX(1044);
	}
Topic archived. No new replies allowed.