Hey guys,
I'm beginner in SFML so please don't be too strict
If I press the right Key for example, a sprite moves.
vehicle.move(speed,0);
Nothing special.
But now I want to create a new Sprite and according to which sprite I choose (by mouse click), I want that the correct sprite moves. To see which sprite was taken I've got a simple variable (int choose=0 if sprite 1 was taken and choose=1 if sprite 2 was taken).
The easiest way to find out which sprite should be moved is
if(choose==0)
{
...
}
if(choose==1)
{
...
}
But in that codes would stand exactly the same. That's not really effective. So can I create a sprite like
sf::Sprite vehicle[2](vehicle1,vehicle2)
...
vehicle[choose].move(speed,0)
Sorry, I know the code is wrong, I'm not really good at using arrays.
Or is there any other simple solution?
Thanks,
5gum