Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what type of c++ container is appropriate?

17 views
Skip to first unread message

nvangogh

unread,
Apr 25, 2013, 12:44:12 PM4/25/13
to
I am in a problem situation.
I have this :
std::vector<sf::Sprite> alien_fleet(55, alien);

This vector will hold a collection of 55 Sprites (for a game). There is
no problem in it compiling. The problem is that each element of the
vector - each 'alien sprite' MUST be associated with a cartesian
coordinate position x , y pixels.

The library i am using takes care of the pixels by allowing me to use
int values. So each alien sprite must simply be associated with a (x, y)
value.

Now, suppose we have:
a total screen size of x by y pixels, and
that each of these alien sprites are say 55x55 pixels in size

How would I go about associating the alien_fleet vector with the system
of x , y coordinates? I think there needs to be another container.

Bearing in mind that the position of each sprite will change during the
execution of the game.

nvangogh

unread,
Apr 25, 2013, 1:07:28 PM4/25/13
to
its ok i worked it out

Anand Hariharan

unread,
May 30, 2013, 9:59:15 AM5/30/13
to
In your post, at every place where you say 'associate', what exactly
do you mean? I would start with looking at the member functions of
sf::Sprite and see what it offers to 'associate' its objects with a
(x, y) value.

- Anand
0 new messages